File Merger CLI is a command-line tool that merges files within a specified directory by extension and outputs the file structure as JSON.
The CLI's output is not intended for human reading.
You can install it globally using npm:
npm install -g file-merger-cli
This tool uses the .file-merger/.gitignore file in the home directory as global gitignore rules. To create this file, run the following commands:
mkdir -p ~/.file-merger
touch ~/.file-merger/.gitignore
file-merger <directory> [options]
- <directory>: The path to the directory to scan (required)
- --log: Enable logging to merge.log file
- --only <extension...>: Process only specified file extensions
- -o, --output : Specify the output directory (default: ./output)
- --help: Display help information
file-merger /path/to/your/directory --log
file-merger /path/to/your/directory --only js ts
file-merger /path/to/your/directory -o /custom/output/path
- Scans all files within the specified directory
- Adheres to .gitignore rules (both global and local)
- Merges files by extension
- Outputs directory structure as a JSON file map
- Creates log files (when option is used)
- Supports custom output directory
- Merged files are saved in the specified output directory (default: ./output)
- The file map JSON is saved as fileMap.json in the output directory
- Log file (if enabled) is saved as merge.log
- Error log is saved as merge_error.log
- If the specified output directory does not exist, it will be created automatically
- If an existing output directory is specified, its contents will be deleted and replaced with new results