> removeDirectoryRecursive "/tmp/d"
Exception: /tmp/d/zzzzz: removeDirectoryRecursive: does not exist (No such file or directory)
Here /tmp/d/ contained a directory foo (with many subdirectories so it took some time to delete), and a subsequent file zzzzzz. Immediately after pressing enter in ghci, I launched a rm zzzzzz. So getDirectoryContents included the file, but it was gone by the time removeFile ran.
I feel that this is a surprising failure mode, and one that would be very easy to recover from, making uses of removeDirectoryRecursive more robust. If removeFile throws an exception due to the file no longer existing, removeDirectoryRecursive could continue with removing the rest of the directory and not propagate the exception.
(Testing rm -rf (on linux) in similar circumstances, I found that it skips over files that have already been deleted by something else, rather than failing.)
Here /tmp/d/ contained a directory foo (with many subdirectories so it took some time to delete), and a subsequent file zzzzzz. Immediately after pressing enter in ghci, I launched a rm zzzzzz. So getDirectoryContents included the file, but it was gone by the time removeFile ran.
I feel that this is a surprising failure mode, and one that would be very easy to recover from, making uses of removeDirectoryRecursive more robust. If removeFile throws an exception due to the file no longer existing, removeDirectoryRecursive could continue with removing the rest of the directory and not propagate the exception.
(Testing rm -rf (on linux) in similar circumstances, I found that it skips over files that have already been deleted by something else, rather than failing.)