View Problem

Process each file in a directory recursively

DiskEdit
python 2.4
import os
results = (process(os.path.join(p, n)) for p,d,l in os.walk(".") for n in l)
ExpandDiskEdit
erlang
filelib:fold_files(Directory, ".*", true, fun (FileOrDirPath, Acc) -> Worker(FileOrDirPath), Acc end, []).
ExpandDiskEdit
erlang
process_dir(Directory, Worker).
ExpandDiskEdit
clojure
; (defn process-file [f] "process one file" body...)
(map process-file (file-seq (File. ".")))
ExpandDiskEdit
cpp C++/CLI .NET 2.0
void processFile(String^ filename) { Console::WriteLine("{0}", filename); }

void processDirectory(String^ dirname)
{
for each(String^ filename in IO::Directory::GetFiles(dirname)) processFile(filename);
for each(String^ subdirname in IO::Directory::GetDirectories(dirname)) processDirectory(subdirname);
}

int main()
{
processDirectory("c:\\");
}

Submit a new solution for python, erlang, clojure, or cpp
There are 11 other solutions in additional languages (fantom, fsharp, groovy, haskell ...)