posix-paths-0.3.0.0: POSIX filepath/directory functionality
Safe HaskellNone
LanguageHaskell2010

System.Posix.Directory.Traversals

Synopsis

Documentation

traverseDirectoryContents :: MonadUnliftIO m => (s -> (DirType, RawFilePath) -> m s) -> s -> RawFilePath -> m s Source #

Apply the action to the given directory (must be a directory), without recursing into subdirectories.

This function does filter out the . and .. entries.

Emitted file paths are the directory entry names, thus not prefixed with the given parent directory.

This function allows for memory-efficient traversals.

Use this if you want to implement your own recursive subdirectory traversal, deciding e.g. into which directories or symlinks to traverse.

You SHOULD check if the obtained DirType is dtUnknown (see comments in man 3 readdir on d_type), and do a getFileStatus in that case (results in stat()), as not all file systems implement obtaining a DirType.

allDirectoryContents :: RawFilePath -> IO [RawFilePath] Source #

Get all files from a directory and its subdirectories.

Upon entering a directory, allDirectoryContents will get all entries strictly. However the returned list is lazy in that directories will only be accessed on demand.

allDirectoryContents' :: RawFilePath -> IO [RawFilePath] Source #

Get all files from a directory and its subdirectories strictly.

traverseDirectory :: MonadUnliftIO m => (s -> RawFilePath -> m s) -> s -> RawFilePath -> m s Source #

Recursively apply the action to the parent file or directory and all files/subdirectories.

Like UNIX find, this includes the parent file/directory!

As for find, emitted file paths of subdirectories contain slashes, starting with the parent directory.

This function allows for memory-efficient traversals.

realpath :: RawFilePath -> IO RawFilePath Source #

return the canonicalized absolute pathname

like canonicalizePath, but uses realpath(3)