store-dir-content is a CLI tool to read files with specific extensions in multiple directories and write their contents to an output file. It supports ignoring specific folders and respecting .gitignore files.
- Read files with specified extensions from multiple directories
- Option to ignore specified folders
- Option to respect
.gitignorefiles - Outputs the contents to a single file with clear dividers between files
To install store-dir-content, use pip:
pip install store-dir-contentYou can use store-dir-content from the command line:
store-dir-content [directories] [-e file_extensions] [-o output_file] [-i ignore_folders] [--respect_gitignore]directories: One or more directories to search for files.-e, --file_extensions: Comma-separated list of file extensions to include (default:.txt).-o, --output_file: Path of the output file where the results will be written (default:output.txt).-i, --ignore_folders: Comma-separated list of folder names to ignore.--respect_gitignore: Respect.gitignorefiles in the directories.
store-dir-content ./dir1 ./dir2This command reads all .txt files in ./dir1 and ./dir2, writing their relative paths and contents to output.txt.
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txtThis command reads all .txt and .md files in ./dir1 and ./dir2, writing their relative paths and contents to my_output.txt.
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txt -i folder1,folder2This command reads all .txt and .md files in ./dir1 and ./dir2, excluding any files in folder1 and folder2, and writes their relative paths and contents to my_output.txt.
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txt --respect_gitignoreThis command reads all .txt and .md files in ./dir1 and ./dir2, respecting the .gitignore rules, and writes their relative paths and contents to my_output.txt.
To contribute to store-dir-content, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/store-dir-content.git
-
Navigate to the project directory:
cd store-dir-content -
Install the package in editable mode with the development dependencies:
pip install -e .[dev]
This project is licensed under the MIT License. See the LICENSE file for details.