Unixutils-1.44: A crude interface between Haskell and Unix-like operating systems




find :: FilePath -> IO [(FilePath, FileStatus)]Source

Traverse a directory and return a list of all the (path, fileStatus) pairs.

removeRecursiveSafely :: FilePath -> IO ()Source

Recursively remove a directory contents on a single file system. The adjective "Safely" refers to these features: 1. It will not follow symlinks 2. If it finds a directory that seems to be a mount point, it will attempt to unmount it up to five times. If it still seems to be a mount point it gives up 3. It doesn't use procmounts, which is ambiguous or wrong when you are inside a chroot.

unmountRecursiveSafely :: FilePath -> IO ()Source

Like removeRecursiveSafely but doesn't remove any files, just unmounts anything it finds mounted. Note that this can be much slower than Mount.umountBelow, use that instead.

renameFileWithBackup :: FilePath -> FilePath -> IO ()Source

Rename src to dst, and if dst already exists move it to dst~. If dst~ exists it is removed.

withWorkingDirectory :: FilePath -> IO a -> IO aSource

temporarily change the working directory to |dir| while running |action|

withTemporaryDirectory :: FilePath -> (FilePath -> IO a) -> IO aSource

create a temporary directory, run the action, remove the temporary directory the first argument is a template for the temporary directory name the directory will be created as a subdirectory of the directory returned by getTemporaryDirectory the temporary directory will be automatically removed afterwards. your working directory is not altered