1.0.1 β€’ Published 7 months ago

folder2txt v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

folder2txt

Convert local folder contents into a single text file with ease. This CLI tool processes all files in a folder and concatenates their contents into a single text file, making it perfect for analysis, documentation, or AI training purposes.

Features

  • πŸ“ Process files in any local folder
  • πŸ“ Convert folder contents to a single text file
  • ⚑ Automatic binary file exclusion
  • πŸ”§ Configurable file size threshold
  • πŸ’» Cross-platform support (Windows, macOS, Linux)

Installation

Install globally via npm:

npm install --global folder2txt

then navigate to the folder you want to convert to a txt file, and run:

$ folder2txt

Options

--output, -o     Specify output file path (default: output.txt)
--threshold, -t  Set file size threshold in MB (default: 0.1)
--include-all    Include all files regardless of size or type
--debug         Enable debug mode with verbose logging
--help          Show help
--version       Show version

Default Behavior

  • Files larger than 100KB are excluded by default
  • Binary files are automatically excluded
  • The output file is created in the current directory and named output.txt
  • Files are processed recursively through all subdirectories (excluding the output file’s directory, node_modules, vendor, .lock files and .git)
  • File paths and contents are separated by clear markers
  • Relative paths are preserved in the output

Output Format

The tool generates a text file with this format:

================================================================================
File: path/to/file.txt
Size: 1.2 KB
================================================================================

[File contents here]

================================================================================
File: another/file.js
Size: 4.5 KB
================================================================================

[File contents here]

Install folder2txt

  1. Using terminal or another CLI, download from npm and install as a global package - npm install -g folder2txt
  2. Using terminal or another CLI, navigate to the folder you want to copy in to a text file.
  3. Run folder2txt.

Update folder2txt

To update to the latest version you can just run the install command again - npm install -g folder2txt

Feedback and issues

Please open an issue in the GitHub repo. Thanks.

License

This project is licensed under the MIT License. See the LICENSE file for details.

folder2txt is based on git2txt by Addy Osmani and retains the original MIT License.

Changelog

1.0.1 Adds more ignored files and folders

1.0.0 Initial release

1.0.1

7 months ago

1.0.0

7 months ago