Library for accessing the directory structure of the underlying operating system.
doesFileExist
:: String -> IO Bool
Returns true if the argument is the name of an existing file.
doesDirectoryExist
:: String -> IO Bool
Returns true if the argument is the name of an existing directory.
getFileSize
:: String -> IO Int
Returns the size of the file.
getModificationTime
:: String -> IO ClockTime
Returns the modification time of the file.
getCurrentDirectory
:: IO String
Returns the current working directory as an absolute path.
setCurrentDirectory
:: String -> IO ()
Sets the current working directory.
getDirectoryContents
:: String -> IO [String]
Returns the list of all entries in a directory.
createDirectory
:: String -> IO ()
Creates a new directory with the given name.
createDirectoryIfMissing
:: Bool -> String -> IO ()
Creates a new directory with the given name if it does not already exist.
If the first parameter is True
it will also create all missing
parent directories.
removeDirectory
:: String -> IO ()
Deletes a directory from the file system.
renameDirectory
:: String -> String -> IO ()
Renames a directory.
Returns the home directory of the current user.
getTemporaryDirectory
:: IO String
Returns the temporary directory of the operating system.
getAbsolutePath
:: String -> IO String
Convert a path name into an absolute one.
For instance, a leading ~
is replaced by the current home directory.
removeFile
:: String -> IO ()
Deletes a file from the file system.
renameFile
:: String -> String -> IO ()
Renames a file.
copyFile
:: String -> String -> IO ()
Copy the contents from one file to another file
findFileWithSuffix
:: String -> [String] -> [String] -> IO (Maybe String)
Looks up the first file with a possible suffix in a list of directories. Returns Nothing if such a file does not exist.
getFileWithSuffix
:: String -> [String] -> [String] -> IO String
Gets the first file with a possible suffix in a list of directories. An error message is delivered if there is no such file.