directory-contents: Recursively build a tree of directory contents.

[ bsd3, library, program, system ] [ Propose Tags ]

Like the linux tree command, this library recursively constructs a tree of directory contents while detecting and avoiding symlink cycles.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2
Change log CHANGELOG.md
Dependencies base (>=4.12 && <4.15), containers (>=0.6 && <0.7), directory (>=1.3 && <1.4), directory-contents, filepath (>=1.4 && <1.5), text (>=1.2 && <1.3), transformers (>=0.5 && <0.6), witherable (>=0.3 && <0.4) [details]
License BSD-3-Clause
Copyright 2020 Obsidian Systems LLC
Author Obsidian Systems
Maintainer maintainer@obsidian.systems
Category System
Bug tracker https://github.com/obsidiansystems/directory-contents/issues
Source repo head: git clone git://github.com/obsidiansystems/directory-contents.git
Uploaded by abrar at 2020-12-10T01:04:10Z
Distributions
Executables readme
Downloads 409 total (13 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for directory-contents-0.1.0.0

[back to package description]

directory-contents

Haskell Hackage Hackage CI Github CI BSD3 License

Recursively list the contents of a directory while avoiding symlink loops.

Description

Modeled after the linux tree command (when invoked with the follow-symlinks option), this module recursively lists the contents of a directory while avoiding symlink loops. In particular, tree -l and buildDirTree should provide the same result. See the documentation of buildDirTree for an example.

In addition to building the directory-contents tree, this module provides facilities for filtering, displaying, and navigating the directory hierarchy.

Example


>
> import Data.Foldable as F
> import Data.List
> import qualified Data.Text as T
> import System.Directory.Contents
> import System.FilePath
>
> main :: IO ()
> main = do
>   mp <- buildDirTree "."
>   case mp of
>     Nothing -> putStrLn "Couldn't find that path."
>     Just p -> do
>       let f = pruneDirTree =<< filterDirTree ((`elem` [".hs", ".lhs"]) . takeExtension) p
>       putStrLn $ case f of
>         Nothing -> "No haskell source files found."
>         Just hs -> unlines
>           [ "Paths that contain haskell source files:"
>           , T.unpack $ drawDirTree hs
>           , ""
>           , "Haskell source files:"
>           , intercalate ", " $ F.toList hs
>           ]
>