A CLI tool to read files and extract content based on extensions.
Project description
store-dir-content
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.
Features
- 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
Installation
To install store-dir-content, use pip:
pip install store-dir-content
Usage
You can use store-dir-content from the command line:
store-dir-content [directories] [-e file_extensions] [-o output_file] [-i ignore_folders] [--respect_gitignore]
Arguments
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.
Examples
Basic Usage
store-dir-content ./dir1 ./dir2
This command reads all .txt files in ./dir1 and ./dir2, writing their relative paths and contents to output.txt.
Custom File Extensions and Output File
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txt
This command reads all .txt and .md files in ./dir1 and ./dir2, writing their relative paths and contents to my_output.txt.
Ignoring Specific Folders
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txt -i folder1,folder2
This 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.
Respecting .gitignore
store-dir-content ./dir1 ./dir2 -e .txt,.md -o my_output.txt --respect_gitignore
This 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.
Development
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]
License
This project is licensed under the MIT License. See the LICENSE file for details.
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 store_dir_content-0.1.tar.gz.
File metadata
- Download URL: store_dir_content-0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd4e801ffb7bfc62677dcda0f29b5cf811cbaa97529bbc997d2ad25923377083
|
|
| MD5 |
fcf1a99ce4bb2a4a904c1daaff82b839
|
|
| BLAKE2b-256 |
90489e2e03a8ab16d0ef814f18657efa5da731f88d09cf5dab321c2beab52e13
|
File details
Details for the file store_dir_content-0.1-py3-none-any.whl.
File metadata
- Download URL: store_dir_content-0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e58f4c8de53cb8c1e075585b3932141effb8e78c562499bcc72751399f9be0dd
|
|
| MD5 |
7aa2bc606698c4c10734dbb65c903351
|
|
| BLAKE2b-256 |
a5f8876b85a2481452cf1a8da4303e3860881058b39dead3df94208d51fb4c61
|