A Python package to generate ASCII tree representation of directory structures.
- Python 3.6 or higher
pip install pygentree
# Basic usage (current directory)
pygentree
# Specify a directory
pygentree /path/to/directory
# Limit depth level
pygentree -l 2
# Sort files and folders
pygentree -s asc # ascending order
pygentree -s desc # descending order
pygentree -s standard # default: folders first, then files
# Show only directories
pygentree -d
# Ignore hidden files and directories, e.g. .git, .env, etc.
pygentree --ignore-hidden
# Exclude specific files or directories (comma-separated)
pygentree -e "node_modules,venv,dist"
# Save output to file (default .txt)
pygentree -o tree.txt
# Save output in different formats
pygentree -o tree.rst --format rst # Save as reStructuredText
pygentree -o tree.txt --format txt # Save as plain text (default)
# Show version
pygentree -v
# Show help
pygentree -h
- Generate ASCII tree representation of directory structures
- Customize maximum depth level
- Multiple sorting options
- Option to show only directories
- Option to ignore hidden files and directories
- Exclude specific files and directories
- Save output to file in multiple formats (txt, rst)
- Handle permission errors gracefully
- Cross-platform compatibility
- Python 3.6
- Python 3.7
- Python 3.8
- Python 3.9
- Python 3.10
- Python 3.11
- Python 3.12
MIT License