fsutils-0.1.2: File system utilities for Haskell that are missing from built in libraries.

Safe HaskellSafe-Inferred

System.Path

Description

A collection of file system utilities that appear to be missing from Directory, FilePath, Prelude, etc. Some of these may overlap with MissingH but the versions here will probably be more simplistic. Furthermore, this library is focused on this one thing and not a whole bunch of things.

Synopsis

Documentation

mtreeList :: Monad m => (a -> m [a]) -> a -> m [a]Source

Returns a list of nodes in a tree via a depth-first walk.

fileList :: FilePath -> IO [FilePath]Source

Recursively list the contents of a directory. Depth-first.

walkDir :: FilePath -> IO [Directory]Source

Walk a directory depth-first. Similar to Python's os.walk and fs.core/walk from the fs Clojure library.

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

Copy a directory recursively. Moves every file, creates every directory.

replaceRoot :: FilePath -> FilePath -> FilePath -> FilePathSource

Given a root path, a new root path, and a path to be changed, removes the old root from the path and replaces it with to.

removeRoot :: FilePath -> FilePath -> FilePathSource

Given a root (prefix), remove it from a path. This is useful for getting the filename and subdirs of a path inside of a root.

data Directory Source

We can use this data type to represent the pieces of a directory.

Instances

dirPath :: Directory -> FilePathSource

The path of the directory itself.

subDirs :: Directory -> [FilePath]Source

All subdirectories of this directory.

files :: Directory -> [FilePath]Source

All files contained in this directory.

createDir :: FilePath -> IO DirectorySource

Creates a Directory instance from a FilePath.

filterUseless :: [FilePath] -> [FilePath]Source

Remove useless paths from a list of paths.