printdirtree is a command-line utility that prints the structure of a directory tree,
allowing you to easily specify files and directories to exclude.
Example:
$ printdirtree
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.pyThis tool is very useful to aid with prompting ChatGPT.
Install printdirtree easily with pip:
pip install printdirtreeTo use printdirtree, simply run the command followed by optional arguments to tailor the output to your needs.
The basic usage prints the current directory structure:
printdirtreeTo print the structure of a specific directory:
printdirtree --dir /path/to/directoryExclude specific directories and/or file patterns:
printdirtree --exclude-dir node_modules --exclude-dir .git --exclude-file "*.log"To save your exclusions for future runs:
printdirtree --exclude-dir temp --exclude-file "*.tmp" --saveSee what exclusions are currently saved:
printdirtree --view-exclusionsTo remove exclusions and include directories or files back into the printout:
printdirtree --include-dir temp --include-file "*.tmp" --saveAfter 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
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py