Command-line tools for identifying exact duplicate files and reviewing potential storage savings in research and shared computing environments.
| Script | Purpose |
|---|---|
duplicate_scan.py |
Scan a directory and write a general duplicate report. |
duplicate_owner_summary.py |
Add file-owner summaries, per-owner reports, and CSV-based quarantine. |
Duplicates are identified by matching file size and a BLAKE3 or SHA-256 content hash. The tools do not detect near-duplicates or files that merely have similar names.
- Python 3 on Linux or macOS
- Read permission for the files being scanned
- Optional:
blake3for faster hashing
git clone https://github.com/FrontLab-DataManagement/duplicates.git
cd duplicates
python -m pip install blake3 # optionalThe owner-aware tool uses POSIX ownership metadata and is not currently supported on Windows.
Run a general scan:
python duplicate_scan.py /path/to/dataRun an owner-aware scan and create per-owner reports:
python duplicate_owner_summary.py /path/to/data --per-owner-filesRestrict the scan to one or more owners:
python duplicate_owner_summary.py /path/to/data \
--user example_user another_user \
--per-owner-filesUse SHA-256 explicitly:
python duplicate_owner_summary.py /path/to/data --hash sha256See all options:
python duplicate_scan.py --help
python duplicate_owner_summary.py --helpThe general scanner writes reports to ./reports/. The owner-aware scanner writes reports to ./user_reports/ and can optionally create one CSV per owner.
Reports include duplicate groups, candidate paths, file ownership, timestamps, hashes, sizes, proposed actions, and potential reclaimable capacity.
Scanning reads file contents for hashing and writes reports, but does not modify source files. Files are moved only when quarantine is explicitly requested and confirmed.
python duplicate_owner_summary.py \
--quarantine-from user_reports/duplicate_report_all_users_YYYYMMDD_HHMMSS.csvBefore quarantining files:
- Verify that a current backup exists.
- Review every proposed action in the CSV.
- Confirm that the retained copy is authoritative and used by no active workflow.
- Use a dedicated quarantine directory on storage with sufficient capacity.
- Retain the quarantine manifest until the project has been validated.
The KEEP selection is a heuristic: the newest modification time is preferred, with the shortest path used as a tie-breaker.
Released under the MIT License. Citation metadata are available in CITATION.cff.