This script combines files with a specified extension (e.g., .md
, .txt
, .js
) from a given directory into a single text file. The files are sorted by name, and each file's path and content are included in the combined output. This functionality is useful for creating a single document from multiple files, such as compiling updated documentation for custom GPTs.
Run the script using the following command format:
./scripts/combine-md.sh <source_directory> <output_file> <file_extension>
<source_directory>
should be the path to the directory containing the files.<output_file>
is the name of the file where the combined content will be stored.<file_extension>
is the extension of the files you want to combine (e.g., md, txt, js).Example:
./script_name.sh ./path/to/github/repo/docs combined_documentation.txt md