There is a dedicated tool in Linux to finds duplicate files in a given set of directories.
yum install fdupes
Now, if---for example---one wants to find duplicates in the /cmn
and /home/tomek
directories, one have to enter the following command:
fdupes -r /cmn /home/tomek
## or prompt the user for files to preserve, deleting all others:
fdupes -r -d /cmn /home/tomek
## or preserve the first file in each set of duplicates and delete
## the others without prompting the user (terrifying dangerous:-):
fdupes -r -d -N /cmn /home/tomek
Note -r
for recursive. Without -r
subdirectories are not scanned. One have to remember not to remove duplicates one needs.
Fdupes
searches the given paths for duplicate files. Such files are found by comparing file sizes and MD5 signatures, followed by a byte-by-byte comparison.
Brak komentarzy:
Prześlij komentarz