Skip to main content

A tool to extract content from text files in a directory, with options to ignore certain files and directories.

Project description

FileContentExtractor

Languages: 🇺🇸English | 🇰🇷한국어

FileContentExtractor is a versatile Python tool designed to recursively extract and save the contents of text files in a directory. It provides various options to ignore specific files or directories, filter files based on several criteria, and output file paths as either absolute or relative paths. The tool also includes user confirmation, version display, and help options for better usability.

Features

  • Recursively traverses directories and extracts the content of text files.
  • Allows you to ignore specific files, directories, or patterns using a .conf file.
  • Outputs file paths as either relative or absolute paths.
  • Supports filtering files by extension, size, and modification date.
  • Allows splitting output into multiple files based on size.
  • Displays a progress bar during extraction.
  • Prompts user confirmation before proceeding with extraction.
  • Provides version information and help details via command-line options.

Installation

You can install the package via pip:

pip install file-content-extractor

Usage

  1. Basic command:

    • Default usage (relative paths):

      fce
      
      • After running this command, you will be prompted to confirm the extraction by typing y.
    • Use absolute paths:

      fce -a
      
  2. Specify additional options:

    • Ignore specific files or directories:

      fce -i my_ignore_list.conf
      
    • Save output to a custom file:

      fce -o my_output.txt
      
    • Filter by file extension, size, and modification date:

      fce -e .txt,.py -m 1024 -M 1048576 -d 2023-01-01
      
    • Split output into multiple files:

      fce -s 10485760
      
    • Specify the directory to start extraction from:

      fce -p /path/to/directory
      
  3. Check version:

    • To display the current version of the tool:

      fce -v
      
  4. Help:

    • To display help information and usage details:

      fce -h
      

Options

  • -a, --absolute: Use absolute paths in the output.
  • -i <file>, --ignore=<file>: Specify a custom ignore file (default is ignore.conf).
  • -o <file>, --output=<file>: Specify a custom output file (default is output.txt).
  • -e <ext1,ext2,...>, --extensions=<ext1,ext2,...>: Specify file extensions to include (e.g., .txt,.py).
  • -m <bytes>, --min-size=<bytes>: Specify minimum file size to include.
  • -M <bytes>, --max-size=<bytes>: Specify maximum file size to include.
  • -d <YYYY-MM-DD>, --modified-after=<YYYY-MM-DD>: Include only files modified after a specific date.
  • -s <bytes>, --split-size=<bytes>: Split output files into chunks of the specified size.
  • -p <directory>, --path=<directory>: Specify the directory to start extraction from.
  • --tree: Print the directory tree of the current path and add it to the output file.
  • --include-ignored: Include files and directories listed in the ignore.conf when printing the directory tree.
  • -h, --help: Show this help message and exit.
  • -v, --version: Show version information and exit.

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

License

This project is licensed

under the MIT License. See the LICENSE file for details.

Author

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

file_content_extractor-0.3.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

file_content_extractor-0.3.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file file_content_extractor-0.3.0.tar.gz.

File metadata

  • Download URL: file_content_extractor-0.3.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for file_content_extractor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0dc107b5e363f43b9e6c289b5dcdd1ce6b25eabde3a3b0bd0249331f56d22fcd
MD5 098c2536c979021c94aa3dfaa1bcebbe
BLAKE2b-256 c775efe53595e5675d78e992e6991a4e3780ddcdfbbdbcaf6585d188d77da006

See more details on using hashes here.

File details

Details for the file file_content_extractor-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for file_content_extractor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 223a2a9f1de641ab5a5d82fdc3d376bbe74ef19d6ae01a69e8fe69dc1ca5d91e
MD5 4e8beb979761cea7d71532d31d65c445
BLAKE2b-256 43fa5ed98a176b0a2ac5a64d5cbc305bd7f4515930e0caec021187b3c427e4c7

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