Skip to main content

A CLI utility to print directory structure.

Project description

pytree

Simplified clone of the Linux tree command.

Supports displaying directory tree structure with colored output, icons, filesizes, filtered views and more. This utility prints as it scans the directories and can be interrupted anytime by pressing CTRL+C.

Example output

$ python -m pytree -is
๐Ÿ“‚ pytree
โ”œโ”€โ”€ ๐Ÿ setup.py [303]
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE [1065]
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore [1799]
โ”œโ”€โ”€ ๐Ÿ“„ README.md [818]
โ”œโ”€โ”€ ๐Ÿ“‚ tests
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ requirements.txt [187]
โ””โ”€โ”€ ๐Ÿ“‚ pytree
    โ”œโ”€โ”€ ๐Ÿ __main__.py [4699]
    โ”œโ”€โ”€ ๐Ÿ formatter.py [223]
    โ”œโ”€โ”€ ๐Ÿ common.py [1205]
    โ”œโ”€โ”€ ๐Ÿ sizes.py [334]
    โ”œโ”€โ”€ ๐Ÿ __init__.py [34]
    โ”œโ”€โ”€ ๐Ÿ fonts.py [1458]
    โ””โ”€โ”€ ๐Ÿ icons.py [541]

2 directories, 12 files

Installation

From PYPI

pip install tree-print

From source

git clone https://github.com/maxcurzi/pytree.git
python -m pip install -e pytree

Test if it works

$ cd pytree
$ python -m pytree
pytree
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ requirements.txt
โ””โ”€โ”€ pytree
    โ”œโ”€โ”€ __main__.py
    โ”œโ”€โ”€ formatter.py
    โ”œโ”€โ”€ common.py
    โ”œโ”€โ”€ sizes.py
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ fonts.py
    โ””โ”€โ”€ icons.py

2 directories, 12 files

Usage

python -m pytree [-h] [-d] [-f FILT] [-i] [-c] [-s] [path]

positional arguments:
  path                  Path to print (defaults to current)

options:
  -h, --help            show this help message and exit
  -d, --dir             Only show directories
  -f FILT, --filt FILT  Filter out files and folders (supports shell-style wildcards such as ? and *)
  -i, --icons           Display icons
  -c, --color           Color output
  -s, --size            Show the file size

Compatibility notes

Should work on both Windows and Linux.

Icons are UTF-8 encoded and may not display correctly on your terminal.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree-print-0.0.0.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file tree-print-0.0.0.tar.gz.

File metadata

  • Download URL: tree-print-0.0.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for tree-print-0.0.0.tar.gz
Algorithm Hash digest
SHA256 b39541f48d12088628458a15768769a253c12e60cd759be95364c4eb56aa308a
MD5 c708307c83650be6956923856e33fea0
BLAKE2b-256 1f2db20a13ecd6affa10ba17d847e10533e1be0e6aa621eeff4eda0bcfaeb546

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page