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
- The script takes a list of file paths as input and iterates through each file.
- For each file, it checks if it exists, reads its contents, and writes the contents to both a text file and a markdown file.
- If a file is not found, it is added to a list of not found files.
- 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
-
Install the
FileHarvestorpackage from PyPI using pip:pip install FileHarvestor
OR
Clone or download the
FileHarvestor.pyscript to your local machine.git clone https://github.com/Hardvan/FileHarvestor cd FileHarvestor pip install .
-
Call the
read_files_in_directoryfunction from theFileHarvestorpackage 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.pyfile for an example of how to use theFileHarvestorpackage.
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
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 FileHarvestor-1.0.3.tar.gz.
File metadata
- Download URL: FileHarvestor-1.0.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db9766c1485bf5ef8ef5a12e15af546df61f17e70a848a184f65294dddaf7856
|
|
| MD5 |
c323c9555b3d5de2c8192ec3f8f8064a
|
|
| BLAKE2b-256 |
9c7e8e2177377ac805d452c0573c678957fab34ea99a2f108fa1b6fc6f5c107c
|
File details
Details for the file FileHarvestor-1.0.3-py3-none-any.whl.
File metadata
- Download URL: FileHarvestor-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2dd7a833bc883a6d6d1444721cc1546d1371ad3b7848ecbe80479bb56fde2c0
|
|
| MD5 |
0d044f1b2570da02851f06d36556b52a
|
|
| BLAKE2b-256 |
716cb205b3d3c92b95f3977994b93a85a1f26cb9a90dc240adfd1727148d70cf
|