seedir is a Python package designed for creating, editing, and displaying folder tree diagrams. It provides a straightforward way to visualize directory structures, supporting both real file systems and 'fake' directory objects for testing or presentation. The library is actively maintained, with its current version being 0.5.1, and receives regular updates.
pip install seedirVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `seedir.seedir()` to print a directory tree. It first creates a temporary directory structure and then visualizes it using the 'lines' style, limiting the depth for conciseness. Finally, it cleans up the created dummy directory.
Instead of importing or calling `seedir.command_line`, use `seedir` directly in the terminal (e.g., `seedir --help`) or `python -m seedir`.
If you use the 'emoji' style or other emoji-dependent features, you must install `seedir` with the `[emoji]` extra: `pip install seedir[emoji]`. Otherwise, an error will be raised when attempting to use an emoji style.
Use the `folderend` parameter instead to specify characters at the end of folder lines.
To specify separate limits for folders and files, pass a 2-tuple `(folder_limit, file_limit)` to `itemlimit`. For example, `itemlimit=(5, 10)` will show up to 5 folders and 10 files per directory.
If you encounter permissions errors or other `OSError` types when `seedir` tries to list directory contents, you can now use `acceptable_listdir_errors` (e.g., `[PermissionError]`) to ignore them and `denied_string` to mark those entries.
You can pass `pathlib.Path` objects directly to the `path` argument of `sd.seedir()`, removing the need for explicit string conversions.
pip install seedir
Ensure the `path` argument points to a valid and existing directory or file.
Use a valid style string such as `'lines'`, `'emoji'`, `'spaces'`, or `'arrow'`.