Module Directory

Library for accessing the directory structure of the underlying operating system.

Author: Michael Hanus

Version: January 2013

Summary of exported operations:

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.
fileSize :: 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.
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.
removeDirectory :: String -> IO ()   
Deletes a directory from the file system.
renameDirectory :: String -> String -> IO ()   
Renames a directory.
getHomeDirectory :: IO String   
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.
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

Exported operations:

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.

fileSize :: 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.

Further infos:
  • externally defined

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.

getHomeDirectory :: IO String   

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