Skip to main content

A cross-platform directory tree visualization tool

Project description

PreTree ๐ŸŒณ

PyPI version PyPI Downloads License: MIT Python 3.6+

A cross-platform Python package for visualizing directory structures in a tree-like format.

Features

  • ๐Ÿ–ฅ๏ธ Cross-platform compatibility
  • ๐ŸŒฒ Tree-like visualization
  • ๐Ÿ“Š Configurable depth
  • ๐Ÿ” Advanced filtering options
  • โšก Both CLI and library usage
  • ๐Ÿ“‚ Sorted output (directories first)
  • ๐Ÿ“ Size-based filtering
  • ๐ŸŽฏ Pattern matching

Demo

$ prettree
D:/Codes/FileTree
โ”œโ”€โ”€ dist
โ”‚   โ”œโ”€โ”€ prettree-0.1.0-py3-none-any.whl (5,368 bytes)
โ”‚   โ””โ”€โ”€ prettree-0.1.0.tar.gz (4,773 bytes)
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ prettree
โ”‚   โ”‚   โ”œโ”€โ”€ __pycache__
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ __init__.cpython-313.pyc (244 bytes)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ cli.cpython-313.pyc (2,792 bytes)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ core.cpython-313.pyc (6,148 bytes)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py (88 bytes)
โ”‚   โ”‚   โ”œโ”€โ”€ cli.py (2,267 bytes)
โ”‚   โ”‚   โ””โ”€โ”€ core.py (4,103 bytes)
โ”‚   โ””โ”€โ”€ prettytree
โ”‚       โ””โ”€โ”€ __init__.py (1 bytes)
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ test_prettree.py (1,384 bytes)
โ”œโ”€โ”€ ~
โ”œโ”€โ”€ LICENSE.md (1,096 bytes)
โ”œโ”€โ”€ pyproject.toml (1,170 bytes)
โ””โ”€โ”€ README.md (1,966 bytes)

Installation

pip install prettree

Usage

Basic Usage

# List current directory
prettree

# List specific directory
prettree /path/to/directory

Advanced Options

# Show hidden files
prettree -a

# Limit depth to 2 levels
prettree -d 2

# Show only files (no directories)
prettree -f

# Show only directories
prettree -D

# Exclude empty directories
prettree -e

# Show only PDF files
prettree -p "*.pdf"

# Exclude configuration files
prettree -x "*.config"

# Show files larger than 1MB
prettree --min-size 1048576

# Show files between 100KB and 1MB
prettree --min-size 102400 --max-size 1048576

As a Python Library

from prettree import list_directory

# Basic usage
for item in list_directory():
    print(item)

# Advanced usage
for item in list_directory(
    "/path/to/directory",
    max_depth=2,
    show_hidden=True,
    only_files=True,
    file_pattern="*.pdf",
    min_size=1048576
):
    print(item)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

prettree-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prettree-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file prettree-0.1.1.tar.gz.

File metadata

  • Download URL: prettree-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for prettree-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7c5f6d82e8bf2822d599470cb2a2d13e1b20c41a4ba02170807452b6c547f726
MD5 a843f49847975429b8a30436491fa695
BLAKE2b-256 de52129e5f9f6e891334e95ed64ab840502267f86f4d85661063384dd864151a

See more details on using hashes here.

File details

Details for the file prettree-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: prettree-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for prettree-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f282e2aa4516f53e0d3258bd5ea9ad4428b5061196ebecc49d7adce6908093a6
MD5 5c95a6252b3e8bbe9bd4e2c84b8ae25e
BLAKE2b-256 ab8bfa315cc02a88c8e4793ebf167a7ee5679fd218bf45a90c4958534d3bb89c

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