Skip to content

bbingju/dupfind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dupfind

Find duplicate files across directories.

Build

Requires CMake, a C11 compiler, and OpenSSL.

mkdir -p build && cd build
cmake ..
make

Usage

dupfind [OPTIONS] [PATH...]

If no PATH is given, the current directory is used.

Options

Option Description
-d, --by-directory Group duplicates by directory pair
-i, --interactive Interactively select files to delete
-j, --json Output results as JSON
-n, --no-recursive Do not recurse into subdirectories
-h, --help Show help message
-v, --version Show version

Examples

Find duplicates in the current directory:

dupfind

Find duplicates across multiple directories:

dupfind ~/photos ~/backup/photos

Group duplicates by directory pair:

dupfind -d ~/data

Interactively review and delete duplicates:

dupfind -i ~/data

Output as JSON:

dupfind -j ~/data

Interactive mode

With -i, dupfind presents each group of duplicates and lets you choose which file to keep. Every deletion requires individual y/n confirmation.

Group 1/3 (SHA-256: abcd1234..., size: 1024 bytes):
  [1] /path/to/file1.txt
  [2] /path/to/copy/file1.txt

Keep which file? [1-2, s=skip, q=quit]: 1
  Delete /path/to/copy/file1.txt? [y/n]: y
  Deleted /path/to/copy/file1.txt

With -i -d, you choose which directory's copies to delete:

Directory pair 1/2: photos/ vs backup/ (under /home/user/):
  vacation.jpg
  portrait.jpg

Delete duplicates from which directory? [1=photos/, 2=backup/, s=skip, q=quit]: 2
  Delete /home/user/backup/vacation.jpg? [y/n]: y
  Deleted /home/user/backup/vacation.jpg
  Delete /home/user/backup/portrait.jpg? [y/n]: y
  Deleted /home/user/backup/portrait.jpg

How it works

  1. Walk the file tree with nftw (symlinks ignored)
  2. Group files by size
  3. Compute SHA-256 hashes for files with matching sizes
  4. Report groups with identical hashes

Testing

cd build && ctest --output-on-failure

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors