Reputation: 411
So I have a directory, /test, and in it are the following files:
test.txt
BasicLoop.vm
FibonacciSeries.vm
StackTest.vm
test.vm
I'm trying to read all the .vm files into one massive string, and in order to do so I thought to use filterM doesFileExist dir
where dir
is the result of getDirectoryContents
, to remove directories and symlinks and whatever, but when I test it, the result of that filter is just BasicLoop.vm and test.vm. None of them are empty, and they show up when I peek at the contents of dir
, so they clearly do exist. Why does the function say they don't?
Upvotes: 2
Views: 450
Reputation:
Why does the function say they don't?
Because getDirectoryContents
returns the file and directory names, not the full filepath. To see that, try something like:
λ:> getDirectoryContents "test"
["data","..","test.dats","."]
Upvotes: 4