
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
A CLI utility to print the directory tree structure with customizable exclusions.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
printdirtree
is a command-line utility that prints the structure of a directory tree,
allowing you to easily specify files and directories to exclude.
You can now also print the contents of all files, which is very useful for prompting LLMs.
Example:
$ printdirtree
PrintDirTree
├── MANIFEST.in
├── README.md
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py
This tool is very useful to aid with prompting ChatGPT.
Install printdirtree
easily with pip:
pip install printdirtree
To 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:
printdirtree
To print the structure of a specific directory:
printdirtree --dir /path/to/directory
Exclude 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" --save
See what exclusions are currently saved:
printdirtree --view-exclusions
To remove exclusions and include directories or files back into the printout:
printdirtree --include-dir temp --include-file "*.tmp" --save
To display both the directory structure and the contents of all files:
printdirtree --show-contents
This will output the directory tree followed by each file's contents with its relative path as a comment. For example:
temp
├── a.py
└── b.py
# temp/a.py
print("a.py")
# temp/b.py
print("b.py")
This is particularly useful when sharing code with LLMs, as it provides both structure and content in a clear, readable format.
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
├── printdirtree
│ ├── __init__.py
│ └── __main__.py
└── setup.py
FAQs
A CLI utility to print the directory tree structure with customizable exclusions.
We found that printdirtree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.