KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What I want is to write a Haskell function to return the files of current directory e.g Change the current directory to :cd c:/code/haskell Then write a function which returns the files in a set e.g [x | x <-getDirectoryContents ] Edited: I have wrote a function sth like this which lists files (ref: http://zvon.org/other/haskell/Outputdirectory/index.html ) import Directory main = _dir "/tmp/FOO" _dir _path =do setCurrentDirectory _path _cd <- getCurrentDirectory print _cd _file <- getDirectoryContents _cd print _file so calling _dir "c:/code/haskell" will list all files + directory names (non-recursive) . What I want now is to call this in a predicate function, for example: [ x| x <- _dir "c:/code/haskell" | x start with 'haskell_' ] so I can apply a filter on file name
Tags (comma-separated)
Save Edits
Cancel