Oct 262008
 

fdupes is a simple Command Line utility to find and list duplicate files in the specified directories. fdupes can also delete the found duplicate files if instructed. fdupes can follow Symlinks and can be instructed to ignore hardlinks. fdupes can also show the size of the duplicate files.

fdupes is a simple and very efficient tool, easy to use.

Install fdupes

“fdupes” can be installed using one of the following 1-click installs based on your openSUSE version.

openSUSE 11.0 ( fdupes-1.40-82.1)

fdupes 1-click install

openSUSE 10.3 ( fdupes-1.40-45)

fdupes 1-click install

openSUSE 10.2 (fdupes-1.40-110.1)

fdupes 1-click install

NOTE: Click here to enable 1-click install in openSUSE 10.2

This should download the YaST MetaPackage file (YMP) and launch the YaST Package manager for installation. Click next on the window showing the selected repositories and next again on the package selection window and finally click Next on the installation proposal window. This should add the required repositories (click import when prompted to import the GPG Keys) and install “fdupes” and required dependencies. Click Finish when the installation is completed succesfully.

This should install fdupes under /usr/bin/fdupes

opensuse11:~ # which fdupes
/usr/bin/fdupes

To simply find the duplicate files in a directory, run fdupes with the name of the directory that it should search as follows

opensuse11:~ # fdupes ~saibaba/Documents/
/home/saibaba/Documents/dup.jog
/home/saibaba/Documents/DSC07101.JPG

/home/saibaba/Documents/DSC07114.JPG
/home/saibaba/Documents/dup2.jog

There you can see it has found two files that has a duplicate.

To show the duplicate files on the same line use the “–sameline” arguement

opensuse11:~ # fdupes –sameline ~saibaba/Documents/
/home/saibaba/Documents/dup.jog /home/saibaba/Documents/DSC07101.JPG
/home/saibaba/Documents/DSC07114.JPG /home/saibaba/Documents/dup2.jog

To delete duplicate files, use the “-d” or “–delete” arguement. fdupes will prompt you to choose the file(s) to preserve.

opensuse11:~ # fdupes -d ~saibaba/Documents/
[1] /home/saibaba/Documents/dup.jog
[2] /home/saibaba/Documents/DSC07101.JPG

Set 1 of 2, preserve files [1 – 2, all]: 2

[-] /home/saibaba/Documents/dup.jog
[+] /home/saibaba/Documents/DSC07101.JPG

[1] /home/saibaba/Documents/DSC07114.JPG
[2] /home/saibaba/Documents/dup2.jog

Set 2 of 2, preserve files [1 – 2, all]: 2

[-] /home/saibaba/Documents/DSC07114.JPG
[+] /home/saibaba/Documents/dup2.jog

For more customizable options, use the “–help” or “-h” arguement or the man pages for fdupes (“man fdupes”)

opensuse11:~ # fdupes -h
Usage: fdupes [options] DIRECTORY…

-r –recurse           include files residing in subdirectories
-s –symlinks          follow symlinks
-H –hardlinks         normally, when two or more files point to the same
disk area they are treated as non-duplicates; this
option will change this behavior
-n –noempty           exclude zero-length files from consideration
-f –omitfirst         omit the first file in each set of matches
-1 –sameline          list each set of matches on a single line
-S –size              show size of duplicate files
-q –quiet             hide progress indicator
-d –delete            prompt user for files to preserve and delete all
others; important: under particular circumstances,
data may be lost when using this option together
with -s or –symlinks, or when specifying a
particular directory more than once; refer to the
fdupes documentation for additional information
-v –version           display fdupes version
-h –help              display this help message

Click here to visit the projects home page