Skip to main content

A simple CLI to export whole directories into a single string with .gitignore support and more.

Project description

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! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gexp-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gexp-1.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file gexp-1.0.1.tar.gz.

File metadata

  • Download URL: gexp-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for gexp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a51512b7071591e282139d3c39c1a227c38d4edb569b398f31dc76c2b5f11622
MD5 fa16d17b1992130168fce24fbb00c966
BLAKE2b-256 983a73d939a2bf57abaed0466acf5e943103c6abb4dc028bc2d161a0e959cd06

See more details on using hashes here.

File details

Details for the file gexp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: gexp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for gexp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 036e982e10fc71700ac5e35d69053360538fd34392a8fa6e3e1ac02f22976644
MD5 6741b872e807c1d843f9a94585dd08df
BLAKE2b-256 433d7361ea4b02927277b436ff9be5efec1717adfa7345d4e77617f78a31397b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page