Convert folder file contents to text for use with large language models like ChatGPT, Claude, Gemini, etc.
To use Folder2Txt, simply run the following command with two parameters:
node folder2txt.js folder=<folder path> output=<output path>
Example:
node folder2txt.js folder=/c/git/folder2txt/ output=/c/public/output.txt
This will recursively process all files in the specified folder and its subfolders, writing the content to the specified output file.
By default, Folder2Txt uses English for its output messages. To switch to Spanish, add the lang=es
parameter to the command:
node folder2txt.js folder=<folder path> output=<output path> lang=es
node folder2txt.js folder=/c/git/folder2txt/ output=/c/public/out2.txt lang=es
You can specify folders and files to ignore during processing by editing the ignore.json
file. See examples in the ignore-json-examples
folder.
{
"folders": ["node_modules", ".git"],
"files": [".DS_Store"]
}
You can also use wildcards (*), example:
"files": [
".DS_Store",
"*.dll",
"*.exe",
"*.pdb",
"appsettings*.json",
"*.user",
"*.Designer.cs"
]
folder
: Path to the folder to be processed.output
: Path to the output file where the content will be written.lang
: (Optional) Language for output messages (default is English).
node folder2txt.js folder=/c/git/folder2txt/ output=/c/public/output.txt
node folder2txt.js folder=/c/git/folder2txt/ output=/c/public/out2.txt lang=es