title: iterate through each file in a directory
body: <p>erlang is a strange language to me, this week i've been playing with multiple languages and I've come here for help often, now I'm on erlang and I'm stuck once again :)</p>
  
  <p>Basically All i'm trying to do is the following but in erlang:</p>
  
  <pre><code>Dim objFSO, objFile, objFolder
  
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  Set objFolder = objFSO.GetFolder(currentDirectory))
  
  For Each objFile in objFolder.Files
     do something with the file
     do something else
     do more stuff
  Next
  </code></pre>
  
  <p>The closest i've come is:</p>
  
  <pre><code>-export([main/1]).
  
  main([]) -&gt; 
  find:files("c:\","*.txt", fun(F) -&gt; {
         File, c:c(File)
  }end).
  </code></pre>
  
  <p>clearly, not working and nothing like how i'd need it to be.. but I have tried many ways and read many example but simply cant figure out a solution maybe the language just isnt ment for this kind of stuff?</p>
  
  <p>And this is needed as a escript (erlang script)</p>