A high-performance directory comparison tool
Project description
HPFC: High-Performance Folder Compare
A high-performance command-line tool for comparing folders and generating detailed reports on file differences. This tool supports cross-platform operation (Windows, Linux, and macOS) and can efficiently handle large volumes of files and large file sizes.
Features
- Compare files in two folders for content differences
- Detect and report three types of inconsistencies:
- Files with different content
- Missing files (present in folder1 but not in folder2)
- Extra files (present in folder2 but not in folder1)
- Cross-platform support (Windows, Linux, and macOS)
- Uses chunked hash comparison algorithm for efficient handling of large files (up to tens of GB)
- Multi-process parallel processing for improved performance
- File and folder ignore patterns
- Detailed reports in both text and HTML formats with GitHub and PyPI links
- Interactive progress bar with ETA display
- Handles tens or hundreds of thousands of files efficiently
Installation
Using pip
pip install hpfc-tool
Note: The package name is
hpfc-tooland the command-line tool ishpfc.
From source
git clone https://github.com/ethan-li/hpfc.git
cd hpfc
pip install .
Usage
Basic Usage
hpfc folder1 folder2
Advanced Options
hpfc folder1 folder2 [options]
Options:
-c,--chunk-size: Chunk size in bytes for comparing large files (default: 8MB)-w,--workers: Number of worker processes for parallel processing (default: CPU count)-i,--ignore: Patterns to ignore (can specify multiple)-o,--output: Save report to specified file (default: console output)--html: Generate an HTML report instead of text--no-progress: Disable progress bar display-v,--version: Show version information
Examples
Compare two folders:
hpfc /path/to/folder1 /path/to/folder2
Ignore specific files or folders:
hpfc /path/to/folder1 /path/to/folder2 --ignore ".git" "*.log" "temp"
Adjust chunk size for large file comparison:
hpfc /path/to/folder1 /path/to/folder2 --chunk-size 16777216 # 16MB
Specify number of worker processes:
hpfc /path/to/folder1 /path/to/folder2 --workers 4
Save report to file:
hpfc /path/to/folder1 /path/to/folder2 --output report.txt
Generate HTML report:
hpfc /path/to/folder1 /path/to/folder2 --html --output report.html
Exit Codes
0: All files are identical1: There are different files, missing files, extra files, or error files
Performance Considerations
- For large files (>8MB), the tool uses chunked hash comparison instead of full file loading to avoid memory overflow
- For small files, direct content comparison is used, which is generally faster than hash calculation
- The tool uses multi-process parallel processing for file comparison to utilize multi-core CPUs
- Performance priority: files are first compared by size, and only if sizes match are contents compared
Running Tests
python -m unittest discover -s tests
To skip large file tests (which may take some time):
SKIP_LARGE_FILE_TEST=1 python -m unittest discover -s tests
Project Structure
hpfc-tool/
├── src/
│ └── hpfc/
│ ├── __init__.py # Package initialization
│ ├── core.py # Core comparison functionality
│ └── cli.py # Command-line interface
├── tests/
│ └── test_hpfc.py # Test cases
├── setup.py # Package setup
└── README.md # Documentation
Notes
- This tool is specifically designed for handling large volumes of files and large file sizes
- Binary and text files are compared in the same way (exact content comparison)
- Ignore patterns use simple substring matching, not wildcards or regular expressions
- HTML reports provide an interactive and visual representation of comparison results
Links
Author
- Ethan Li - Initial work and maintenance
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hpfc_tool-0.2.0.tar.gz.
File metadata
- Download URL: hpfc_tool-0.2.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc135adced3002f206f4933265c2c2df55b8875cf2c449bc1a3424e3846c565b
|
|
| MD5 |
da4255c94e07ed267f5bd5eda400a356
|
|
| BLAKE2b-256 |
fc5b77c683d651ecc263307ac9447a120e766ac0d3332e5927fa9e6339a8229e
|
File details
Details for the file hpfc_tool-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hpfc_tool-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed16e6df545c114ff7f30beaa56d2ad65410917c97fd10ecbf06c91002e6ba96
|
|
| MD5 |
32dd0303beccdbe69718f95724ce82a6
|
|
| BLAKE2b-256 |
896249f37b24a9558a3e02e166ae46216ae5e86dc5b8b8a92d06a4fa2c91a02c
|