fcompare is a Bash-based command-line tool to compare two folders and generate clear reports on differences. It highlights file additions, deletions, and content changes using rsync and diff, with both plain-text and HTML output.
Perfect — that structure is clean, flexible, and user-friendly. Here's how you can document the two options in your README.md under an Installation section:
You have two options to use fcompare:
Run fcompare.sh directly from your project or any folder.
Requirements in same folder:
fcompare.sh(main script)exclude.txt(optional exclude list)fcompare_html_report.php(for HTML output)
./fcompare.sh -s ../src -d ../dst -n diff_reportThis method requires no installation and is great for testing or use in specific projects.
Make fcompare available system-wide.
sudo cp fcompare.sh /usr/local/bin/fcompare
sudo chmod +x /usr/local/bin/fcompare
sudo mkdir -p /usr/local/lib/fcompare
sudo cp fcompare_html_report.php /usr/local/lib/fcompare/Now you can run it from anywhere:
fcompare -s ../src -d ../dst -n my_report💡 The HTML report generator will be found at:
/usr/local/lib/fcompare/fcompare_html_report.php
sudo rm /usr/local/bin/fcompare
sudo rm /usr/local/lib/fcompare/fcompare_html_report.phpfcompare -r -s <source> -d <destination> -n <name> [-o <output folder>] [-x <exclude file>]-s <source>: Source folder (e.g.../dev)-d <destination>: Destination folder to compare against (e.g.../production)-n <name>: A short identifier to label the result files (e.g.dev_VS_production)
-r: recursive-o <output folder>: Where to store the result files Default: current directory-x <exclude file>: exclude file (e.g../project/exclude.txt)
The following files will be created:
-
<name>_RESULT_RSYNC_DRY.txtList of changed/missing files detected byrsync --dry-run -
<name>_DIFFERENCES.txtPlain-text output showing line-by-line diffs -
<name>_DIFFERENCES.htmlColor-coded HTML report (green = added, red = removed)
fcompare -s ../dev -d ../production -n dev_VS_production -o ./outCreates:
out/
├── RESULT_RSYNC_DRY_dev_VS_production.txt
├── DIFFERENCESdev_VS_production.txt
└── DIFFERENCES_dev_VS_production.html
Here's what your DIFFERENCES.html looks like with fcompare:
Add ignore rules to an exclude.txt file in the same directory as the script. This is passed to rsync using --exclude-from=exclude.txt.
Example exclude.txt:
*.log
node_modules/
.cache/
Make sure you have the following installed:
bashrsyncdiffphp(required forfcompare_html_report.phpto generate the HTML output)
--opento auto-open the HTML report after generation--no-htmlto generate text-only output- Color-coded CLI preview
- Optional recursive vs non-recursive modes
MIT — use it freely, modify it, and share it.
