Go to file
Kevin Veen-Birkenbach 89e15dd023 Reimplemented by an accident deleted function 2023-11-14 15:33:32 +01:00
.gitignore updated test script 2023-11-14 13:18:30 +01:00
LICENSE Initial commit 2023-06-28 11:44:43 +02:00
README.md updated README.md 2023-11-14 13:23:12 +01:00
create_file_structure.py updated test script 2023-11-14 13:18:30 +01:00
main.py Reimplemented by an accident deleted function 2023-11-14 15:33:32 +01:00

README.md

Duplicate File Handler

This repository contains a Python script for identifying and handling duplicate files in a directory and its subdirectories based on their MD5 hash. It allows for filtering by file type and provides options for handling duplicates such as deletion, hard linking, or sym linking.

Author

This repository was enhanced with the help of OpenAI's ChatGPT.

Setup

To use the script, ensure you have Python installed on your system. No additional libraries are required as the script uses standard Python libraries.

Usage

Identifying and Handling Duplicates

main.py is a Python script to identify all duplicate files in the specified directories. It can also filter by file type and handle duplicates by deleting them or replacing them with hard or symbolic links.

python main.py [options] directories

Options

  • --apply-to: Directories to apply modifications to.
  • --modification: Action to perform on duplicates - delete, hardlink, symlink, or show (default).
  • --mode: How to apply the modifications - act, preview, interactive (default: preview).
  • -f, --file-type: Filter by file type (e.g., .txt for text files).

Creating Test File Structure

create_file_structure.py is a utility script to create a test file structure with duplicate files for testing purposes.

python create_file_structure.py

Example

To preview duplicate .txt files in test_dir1 and test_dir2:

python main.py --file-type .txt --mode preview test_dir1 test_dir2

To interactively delete duplicates in test_dir2:

python main.py --apply-to test_dir2 --modification delete --mode interactive test_dir1 test_dir2

License

This project is licensed under the terms of the MIT License.