A colorful, icon-rich directory tree printer for your terminal. It walks a path, shows folders/files with Nerd Font icons, colors directories blue and files green, and can hide dotfiles by default.
- Python 3.6+
- A Nerd Font (icons come from
ptree/icons-sample.yaml) - Dependencies:
colorama,pyyaml(install viapip install -r requirement.txtorpip install -e .)
git clone pip install git+https://github.com/Nii-Antiaye/ptree.git
cd ptree
python -m venv .venv && .\.venv\Scripts\activate
pip install -r requirement.txtAlternatively, install in editable mode to get the console script:
pip install -e .From the repo without installing:
python ptree/main.py .After installing with the console entry point:
ptree .Options:
--all- include hidden files/folders.-d,--directory- show directories only.-l,--level <n>- limit the depth printed (0 keeps going).--prune- drop empty directories from the output.-s,--size- show file sizes in a human-readable form.
Example:
ptree . --all --level 2 --size
Sample output (icons depend on your font):
<dir_icon> .
├── <dir_icon> src
│ ├── [size] <file_icon> main.py
│ └── [size] <file_icon> utils.py
└── [size] <file_icon> README.md
<dir_icon> 3 directories, <file_icon> 5 files
- Edit
ptree/icons-sample.yamlor copy it to another YAML file. - Three sections are supported:
filetype(general defaults),name(exact file/dir names), andextension(by file extension). - Icons use Nerd Font glyphs; restart the command after edits.
- Hidden items (names starting with
.) are skipped unless--allis set. - The tree order lists directories before files.
- Color output uses
colorama; Windows terminals are supported out of the box.