[Haskell] Reading a directory tree

John Hughes rjmh at cs.chalmers.se
Tue Jun 22 05:32:42 EDT 2004


> Hi,
>
> I'm looking for a way to iteratively read all the files in a directory and
> its subdirectories, given the filepath of the top-level dir.
> For example, I want to find a file, corresponding to a given filename, in
> a directory and its subdirectories.
>

getDirectoryContents is your friend. It's a function in the standard
library Directory, documented here:
http://haskell.org/onlinereport/directory.html

getDirectoryContents  :: FilePath -> IO [FilePath]

A FilePath is just a String.

John Hughes


More information about the Haskell mailing list