Thursday, 2 June 2016

Haskell: doesDirectoryExist: Check for directory existence

System.Directory module provides doesDirectoryExist funciton, which takes a directory name as input and return True, if the directory exists, else False. Following is the signature of doesDirectoryExist function.

doesDirectoryExist :: FilePath -> IO Bool
Prelude System.Directory> doesDirectoryExist "/Users"
True
Prelude System.Directory> doesDirectoryExist "/Users123"
False
Prelude System.Directory> doesDirectoryExist "/Users/harikrishna_gurram"
True



Previous                                                 Next                                                 Home

No comments:

Post a Comment