Command-line tool for recursively traversing directories to print file paths and their contents.
Project description
RecurseReader CLI Utility
RecurseReader is a powerful and user-friendly command-line tool for recursively traversing directories to print file paths and their contents. It is designed with flexibility in mind, offering robust filtering and output options to suit a wide range of use cases.
Features 🚀
- Recursive Traversal: Walk through directories and list files along with their contents.
- Dot Directory Filtering: Optionally ignore directories starting with a dot (e.g.,
.git). - Hidden File Support: Choose whether to include hidden files (starting with a dot) in the output.
- Depth Limitation: Control how deep the traversal goes.
- Logging: Save the output to a log file for later review.
- Encoding Safety: Handle files with different encodings gracefully.
Installation 📦
Ensure you have Python 3.8+ installed on your system. Clone the repository and use the script directly:
git clone https://github.com/your-repo/recurse-reader.git
cd recurse-reader
python recurse_reader.py --help
Usage 🛠️
RecurseReader offers a variety of command-line arguments to customize its behavior. Here are some examples:
Basic Usage
Traverse a directory and display file paths and contents:
python recurse_reader.py /path/to/directory
Ignore Dot Directories
Skip directories that start with a dot:
python recurse_reader.py /path/to/directory --ignore-dot-dirs
Include Hidden Files
Include hidden files in the output:
python recurse_reader.py /path/to/directory --show-hidden-files
Limit Depth
Restrict the depth of traversal to two levels:
python recurse_reader.py /path/to/directory --max-depth 2
Log Output to File
Save the output to a log file:
python recurse_reader.py /path/to/directory --log-to-file output.log
Full Argument Reference 🗂️
usage: recursereader [-h] [--ignore-dot-dirs] [--show-hidden-files] [--max-depth MAX_DEPTH] [--gitignore GITIGNORE]
[--ignore-subfolders IGNORE_SUBFOLDERS [IGNORE_SUBFOLDERS ...]] [--log-to-file LOG_TO_FILE]
root_dir
Recursively print file paths and contents from a directory.
positional arguments:
root_dir The root directory to start the search.
options:
-h, --help show this help message and exit
--ignore-dot-dirs Ignore directories starting with a dot (e.g., '.git').
--show-hidden-files Include hidden files (files starting with a dot) in the output.
--max-depth MAX_DEPTH
Maximum depth to traverse (e.g., 2 for two levels deep).
--gitignore GITIGNORE
Path to a .gitignore-like file with patterns to ignore.
--ignore-subfolders IGNORE_SUBFOLDERS [IGNORE_SUBFOLDERS ...]
Specific subfolders to ignore (provide a space-separated list).
--log-to-file LOG_TO_FILE
Specify a file to log the output instead of printing to the console.
Example Output ✨
Here is what the output might look like when running RecurseReader:
Path: /example/project/README.md
Contents:
# Welcome to My Project
---
Path: /example/project/src/main.py
Contents:
print("Hello, World!")
---
License 📜
RecurseReader is licensed under the MIT License.
Contributing 🤝
We welcome contributions! Feel free to submit issues or pull requests to improve RecurseReader.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file recursereader-0.0.1.tar.gz.
File metadata
- Download URL: recursereader-0.0.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a934b4b3924484c4860c9d2683aeb94bef7d75db88d542cd0e227917d49934
|
|
| MD5 |
250094bd6b28ae7643ffc1ad2dc9da17
|
|
| BLAKE2b-256 |
6085aa58495efa688bdefe523b64ddac436cebdeb046220a51774ba24cd6524d
|
File details
Details for the file recursereader-0.0.1-py3-none-any.whl.
File metadata
- Download URL: recursereader-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
810483397d9718df1f55f77b325768587e3092efef9a630870463747dbc9d9da
|
|
| MD5 |
f6ee77f1a8121943e5a168780a052a8f
|
|
| BLAKE2b-256 |
5096130e7a2f097c0c15320e2e36710eb84445e44b84e98593c9ffacfc89e447
|