# 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:
```bash
pip install FileHarvestor
```
OR
Clone or download the `FileHarvestor.py` script to your local machine.
```bash
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.
```python
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 for an example of how to use the `FileHarvestor` package.
Raw data
{
"_id": null,
"home_page": "https://github.com/Hardvan/FileHarvestor",
"name": "FileHarvestor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "file, harvestor, read, write, text, markdown, file-reader, read-file",
"author": "Hardik Pawar",
"author_email": "hardikpawarh@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9c/7e/8e2177377ac805d452c0573c678957fab34ea99a2f108fa1b6fc6f5c107c/FileHarvestor-1.0.3.tar.gz",
"platform": null,
"description": "# FileHarvestor\r\n\r\nThis 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.\r\n\r\n## Features\r\n\r\n- Reads the contents of specified files.\r\n- Writes the contents to both a text file (`contents.txt`) and a markdown file (`contents.md`).\r\n- Handles non-existent files and maintains a list of files that were not found.\r\n- Provides a summary of the process, including read times for each file and overall execution time.\r\n\r\n## How it works\r\n\r\n1. The script takes a list of file paths as input and iterates through each file.\r\n2. For each file, it checks if it exists, reads its contents, and writes the contents to both a text file and a markdown file.\r\n3. If a file is not found, it is added to a list of not found files.\r\n4. The script provides detailed output about the success or failure of reading each file and summarizes the overall process at the end.\r\n\r\nFunction arguments:\r\n\r\n- **file_list (list, optional):** List of files to read. Defaults to None.\r\n- **output_text_file (str, optional):** Output text file. Defaults to './output/contents.txt'.\r\n- **output_markdown_file (str, optional):** Output markdown file. Defaults to './output/contents.md'.\r\n\r\n## Usage\r\n\r\n1. Install the `FileHarvestor` package from PyPI using pip:\r\n\r\n ```bash\r\n pip install FileHarvestor\r\n ```\r\n\r\n OR\r\n\r\n Clone or download the `FileHarvestor.py` script to your local machine.\r\n\r\n ```bash\r\n git clone https://github.com/Hardvan/FileHarvestor\r\n cd FileHarvestor\r\n pip install .\r\n ```\r\n\r\n2. Call the `read_files_in_directory` function from the `FileHarvestor` package with the directory path as an argument.\r\n\r\n ```python\r\n from FileHarvestor import read_files_in_directory\r\n\r\n read_files(file_list=['./path/to/file1.txt', './path/to/file2.txt'], output_text_file='./output/contents.txt', output_markdown_file='./output/contents.md')\r\n ```\r\n\r\n View the `run.py` file for an example of how to use the `FileHarvestor` package.\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "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.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/Hardvan/FileHarvestor"
},
"split_keywords": [
"file",
" harvestor",
" read",
" write",
" text",
" markdown",
" file-reader",
" read-file"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "716cb205b3d3c92b95f3977994b93a85a1f26cb9a90dc240adfd1727148d70cf",
"md5": "0d044f1b2570da02851f06d36556b52a",
"sha256": "d2dd7a833bc883a6d6d1444721cc1546d1371ad3b7848ecbe80479bb56fde2c0"
},
"downloads": -1,
"filename": "FileHarvestor-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d044f1b2570da02851f06d36556b52a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6064,
"upload_time": "2024-09-09T12:09:08",
"upload_time_iso_8601": "2024-09-09T12:09:08.599789Z",
"url": "https://files.pythonhosted.org/packages/71/6c/b205b3d3c92b95f3977994b93a85a1f26cb9a90dc240adfd1727148d70cf/FileHarvestor-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9c7e8e2177377ac805d452c0573c678957fab34ea99a2f108fa1b6fc6f5c107c",
"md5": "c323c9555b3d5de2c8192ec3f8f8064a",
"sha256": "db9766c1485bf5ef8ef5a12e15af546df61f17e70a848a184f65294dddaf7856"
},
"downloads": -1,
"filename": "FileHarvestor-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c323c9555b3d5de2c8192ec3f8f8064a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5396,
"upload_time": "2024-09-09T12:09:10",
"upload_time_iso_8601": "2024-09-09T12:09:10.737953Z",
"url": "https://files.pythonhosted.org/packages/9c/7e/8e2177377ac805d452c0573c678957fab34ea99a2f108fa1b6fc6f5c107c/FileHarvestor-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 12:09:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hardvan",
"github_project": "FileHarvestor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "fileharvestor"
}