gexp
gexp is a CLI tool to recursively export text files from a directory, while respecting .gitignore, allowing filtering via include/exclude patterns, limiting file size, and displaying the top N largest extracted files.
Features
- Respects
.gitignore– Automatically skips files and directories listed in.gitignore. - Recursive Export – Scans all subdirectories and includes files matching criteria.
- Include/Exclude Filtering – Use patterns to specify which files should be included or excluded.
- File Size Limit – Skip files larger than a specified size.
- Binary File Detection – Automatically skips binary files.
- Top-N Largest Files Listing – Always prints the N largest extracted files to the console.
- Output to File – Optionally write the extracted contents to a file.
Installation
Install gexp from PyPI:
pip install gexp
Usage
Basic Usage
To export all text files from the current directory:
gexp
Specify a Directory
To export from a specific directory:
gexp /path/to/directory
Write Output to a File
To write the extracted files' content to a file instead of printing:
gexp -o output.txt
Limit File Size
To skip files larger than 500 KB:
gexp --max-size 500000
Filter by Name
gexp --include "*.py"
Exclude Specific Directories or Files
To exclude all files in the docs/ directory:
gexp --exclude "docs/**"
Combine Include and Exclude
To export only .py files while excluding test files:
gexp --include "*.py" --exclude "test_*.py"
Show Top N Largest Extracted Files
To print the 5 largest extracted files:
gexp --top-n 5
Full Example
Export only .md and .txt files, exclude the node_modules/ folder, limit file size to 1 MB, and save output to export.md:
gexp --include "*.md" --include "*.txt" --exclude "node_modules/**" --max-size 1000000 -o export.md
Changelog
See CHANGELOG.md for more details.
License
This project is licensed under the MIT License.
Happy exporting! 🚀
Metadata
Release files for gexp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gexp-1.0.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gexp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / gexp-1.0.1.tar.gz
| Download URL | gexp-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a51512b7071591e282139d3c39c1a227c38d4edb569b398f31dc76c2b5f11622
|
|
BLAKE2b-256 checksum How to use checksums |
983a73d939a2bf57abaed0466acf5e943103c6abb4dc028bc2d161a0e959cd06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / gexp-1.0.1-py3-none-any.whl
| Download URL | gexp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
036e982e10fc71700ac5e35d69053360538fd34392a8fa6e3e1ac02f22976644
|
|
BLAKE2b-256 checksum How to use checksums |
433d7361ea4b02927277b436ff9be5efec1717adfa7345d4e77617f78a31397b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|