Thursday 2 June 2016

Haskell: findFiles: Search for a file in given directories

System.Directory module provides findFiles function, which takes list of directories to search, filename as arguments and return list of paths. Following is the signature of findFiles function.

Prelude System.Directory> :t findFiles

findFiles :: [FilePath] -> String -> IO [FilePath]
Prelude System.Directory> findFiles ["/Users/harikrishna_gurram", "/var", "/Users/harikrishna_gurram/logs"] "temp.log"
["/Users/harikrishna_gurram/temp.log","/Users/harikrishna_gurram/logs/temp.log"]
Prelude System.Directory> 
Prelude System.Directory> findFiles ["/Users/harikrishna_gurram", "/var", "/Users/harikrishna_gurram/logs"] "temp1.log"
[]



Previous                                                 Next                                                 Home

No comments:

Post a Comment