Skip to main content

FileHarvestor is a Python utility that reads the contents of specified files and writes them to both text and markdown files. If a file does not exist, it is added to a list of not found files. This tool is useful for consolidating and documenting the contents of multiple files in a directory.

Project description

FileHarvestor

This script is a Python utility that reads the contents of specified files and writes them to both text and markdown files. If a file does not exist, it is added to a list of not found files. This tool is useful for consolidating and documenting the contents of multiple files in a directory.

Features

  • Reads the contents of specified files.
  • Writes the contents to both a text file (contents.txt) and a markdown file (contents.md).
  • Handles non-existent files and maintains a list of files that were not found.
  • Provides a summary of the process, including read times for each file and overall execution time.

How it works

  1. The script takes a list of file paths as input and iterates through each file.
  2. For each file, it checks if it exists, reads its contents, and writes the contents to both a text file and a markdown file.
  3. If a file is not found, it is added to a list of not found files.
  4. The script provides detailed output about the success or failure of reading each file and summarizes the overall process at the end.

Function arguments:

  • file_list (list, optional): List of files to read. Defaults to None.
  • output_text_file (str, optional): Output text file. Defaults to './output/contents.txt'.
  • output_markdown_file (str, optional): Output markdown file. Defaults to './output/contents.md'.

Usage

  1. Install the FileHarvestor package from PyPI using pip:

    pip install FileHarvestor
    

    OR

    Clone or download the FileHarvestor.py script to your local machine.

    git clone https://github.com/Hardvan/FileHarvestor
    cd FileHarvestor
    pip install .
    
  2. Call the read_files_in_directory function from the FileHarvestor package with the directory path as an argument.

    from FileHarvestor import read_files_in_directory
    
    read_files(file_list=['./path/to/file1.txt', './path/to/file2.txt'], output_text_file='./output/contents.txt', output_markdown_file='./output/contents.md')
    

    View the run.py file in the example directory for a working example.

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

FileHarvestor-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

FileHarvestor-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file FileHarvestor-1.0.0.tar.gz.

File metadata

  • Download URL: FileHarvestor-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.4

File hashes

Hashes for FileHarvestor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4dea86d990c10b1f553800477184224bdc5c6097c82170f2e50d01359242e9a4
MD5 25e97932752394ab18ec73d440d6fdc3
BLAKE2b-256 b7597368661742a2ffb70cd3954463b39269e29566e63da7763c26ac7225e2c1

See more details on using hashes here.

File details

Details for the file FileHarvestor-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for FileHarvestor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cec5233da00d7a5a67f23d7aaa3f97cc5a6db68ab8ca0f8c9bbb2fdde75e1aa0
MD5 772f12187f450d3f360ddca7147ded4d
BLAKE2b-256 2621629144790c688cc331396949292486882cfacb56e31ff184ac0e7f9c57a8

See more details on using hashes here.

Supported by

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