Todd Wolven
Theme

Duplicate File Finder and Remover

By Todd Wolven · Updated 2025-01-05 · Source on GitHub

Overview

This Python script scans directories to identify and optionally remove duplicate files based on their name and size. It is designed to work on local drives, network-attached storage (NAS), and mounted shares.

The tool generates detailed CSV reports for review before performing any deletions and logs all operations, ensuring safety and transparency.


Features


Requirements

Dependencies

No additional libraries are required beyond Python's standard library.


Usage

1. Listing Duplicates

To scan the current directory and generate a report of duplicates:

python duplicate_finder.py -l
- Generates a CSV file (e.g., duplicates_YYYYMMDD_HHMMSS.csv) in the current directory. - Estimates potential space savings based on duplicate sizes.

2. Removing Duplicates

To remove duplicates based on the most recent CSV file:

python duplicate_finder.py -r
- Prompts for confirmation before deleting files. - Retains the first instance of each duplicate and deletes the rest. - Logs detailed results, including retained and deleted files, errors, and space savings.


Example Workflow

  1. Scan for duplicates:
    python duplicate_finder.py -l
  2. Review the CSV file to verify duplicates.
  3. Remove duplicates safely:
    python duplicate_finder.py -r
  4. Review logs for details: - removal_log_YYYYMMDD_HHMMSS.txt

Notes


Error Handling


License

This project is licensed under the MIT License. See LICENSE for details.


Disclaimer

Use this tool at your own risk. Review all reports and logs carefully before proceeding with deletions. The authors are not responsible for accidental data loss.

This page is generated automatically from the GitHub README, which is the single source of truth.  ← Back to toddwolven.com