Skip to main content

A CLI utility to print the directory tree structure with customizable exclusions.

Project description

PrintDirTree

printdirtree is a command-line utility that prints the structure of a directory tree, offering the flexibility to specify files and directories to exclude. This tool is very useful to aid with prompting ChatGPT.

Installation

Install printdirtree easily with pip:

pip install printdirtree

Usage

To use dirtree, simply run the command followed by optional arguments to tailor the output to your needs. The basic usage prints the current directory structure:

printdirtree

Specifying a Directory

To print the structure of a specific directory:

printdirtree --dir /path/to/directory

Excluding Directories and Files

Exclude specific directories and/or file patterns:

printdirtree --exclude-dir node_modules --exclude-dir .git --exclude-file "*.log"

Saving Preferences

To save your exclusions for future runs:

printdirtree --exclude-dir temp --exclude-file "*.tmp" --save

Viewing Current Exclusions

See what exclusions are currently saved:

printdirtree --view-exclusions

Including Directories and Files Back

To remove exclusions and include directories or files back into the printout:

printdirtree --include-dir temp --include-file "*.tmp" --save

Example Usage

After installing printdirtree, you can run it to visualize the structure of your project directory. Here's an example command that excludes .git files:

printdirtree --exclude-file ".git"

Output for the PrintDirTree project might look like this:

PrintDirTree
├── MANIFEST.in
├── README.md
├── dir_tree_prefs.json
├── printdirtree
│   ├── __init__.py
│   └── __main__.py
└── setup.py

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

printdirtree-0.1.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

printdirtree-0.1.1-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

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