A module for performing operations on directories.
- chdir :: FilePath -> IO a -> IO a
- mkdir :: FilePath -> IO ()
- rmdir :: FilePath -> IO ()
- archiveDirectories :: [(FilePath, FilePath)] -> RecursionPredicate -> FilterPredicate -> [ZipOption] -> IO Archive
- writeArchive :: [(FilePath, FilePath)] -> RecursionPredicate -> FilterPredicate -> [ZipOption] -> FilePath -> IO ()
- writeHashArchive :: [(FilePath, FilePath)] -> RecursionPredicate -> FilterPredicate -> [ZipOption] -> FilePath -> IO ()
- copy :: RecursionPredicate -> FilterPredicate -> FilePath -> FilePath -> IO ()
- copyl :: RecursionPredicate -> FilterPredicate -> Int -> FilePath -> FilePath -> IO ()
- dropRoot :: FilePath -> String
- dropRoot' :: Int -> FilePath -> FilePath
Directory manipulating
:: FilePath | The directory to change to. |
-> IO a | The action to execute in the given directory. |
-> IO a | The result of executing the given action. |
Change to the given directory, then execute the given action, then change back to the original directory.
Creates the given directory and its parents if it doesn't exist.
Removes the given directory recursively if it exists.
Directory archiving
:: [(FilePath, FilePath)] | A list of base directories to change to and contents of that directory to archive. |
-> RecursionPredicate | The recursion predicate to search for files to archive. |
-> FilterPredicate | The filter predicate to search for files to archive. |
-> [ZipOption] | The options during the creation of the archive. |
-> IO Archive | The constructed archive. |
Create a zip archive by changing into directories and archiving the contents.
:: [(FilePath, FilePath)] | A list of base directories to change to and contents of that directory to archive. |
-> RecursionPredicate | The recursion predicate to search for files to archive. |
-> FilterPredicate | The filter predicate to search for files to archive. |
-> [ZipOption] | The options during the creation of the archive. |
-> FilePath | The file to write the archive to. |
-> IO () |
Writes a zip archive to a file.
:: [(FilePath, FilePath)] | A list of base directories to change to and contents of that directory to archive. |
-> RecursionPredicate | The recursion predicate to search for files to archive. |
-> FilterPredicate | The filter predicate to search for files to archive. |
-> [ZipOption] | The options during the creation of the archive. |
-> FilePath | The file to write the archive to and the prefix name of the files containing the hashes. |
-> IO () |
Copying directories
:: RecursionPredicate | The recursion predicate to search for files in the source directory. |
-> FilterPredicate | The filter predicate to search for files in the source directory. |
-> FilePath | The source directory. |
-> FilePath | The target directory. |
-> IO () |
Copy the contents of a directory to another, perhaps trimming parent directories.
:: RecursionPredicate | The recursion predicate to search for files in the source directory. |
-> FilterPredicate | The filter predicate to search for files in the source directory. |
-> Int | The number of parent directories to drop before copying to the target directory. |
-> FilePath | The source directory. |
-> FilePath | The target directory. |
-> IO () |
Copy the contents of a directory to another, perhaps trimming parent directories.
:: FilePath | The file path to drop the parent directory from. |
-> String | The file path without a parent directory. |
Drops the parent directory of a given file path.
dropRoot "/foo/bar" == "/bar" dropRoot "foo/bar" == "bar" dropRoot "foo" == "" dropRoot "" == ""
:: Int | The number of times to drop the parent directory. |
-> FilePath | The file path to drop parent directories from. |
-> FilePath | Te file path without parent directories. |
Drops the parent directory (dropRoot
) of a given file path multiple times.
dropRoot' 0 "/foo/bar" == "/foo/bar" dropRoot' 1 "/foo/bar" == "/bar" dropRoot' 1 "foo/bar" == "bar" dropRoot' 2 "foo/bar" == "" dropRoot' 10 "foo/bar" == ""