View Problem

Process each file in a directory

DiskEdit
python 2.4
import os
results = (process(f) for f in os.listdir(".") if os.path.isfile(f))
ExpandDiskEdit
clojure
; (defn process-file [f] "process one file" body...)
(map process-file (.listFiles (File. ".")))
ExpandDiskEdit
erlang
% File basenames only - many tasks require absolute paths to work
lists:foreach(fun (FileOrDirPath) -> Worker(FileOrDirPath) end, file:list_dir(Directory)).
ExpandDiskEdit
erlang
% Absolute paths provided - will accomodate most tasks
lists:foreach(fun (FileOrDirPath) -> Worker(FileOrDirPath) end, list_dir_path(Directory)).

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