Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-21-2011, 11:17 AM   #1
blue frog
LQ Newbie
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
detect duplicate files using md5sum

Hi guys,
What i am trying is to check the file duplication in a folder and remove a file if it is a duplicate of another file ie the contents are duplicate; but names may be same.
Basically i am using md5sum to calculate the md5sum values of each file and redirecting to a file. And i am thinking of comparing the md5sum values.But i am finding it hard to decide how to complete the code after redirecting the output of calculation of md5sum to a file. Any help will be appreciated .
Old 02-21-2011, 11:44 AM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
Ok, so how are you trying to do this? In a script? In what distro (good to know)? You need to provide us with enough information to help you. Read the following link to know how to ask a question in these forums...

As far as your problem, I would throw suggestions out, but I don't even know how you are trying to do it. Reply back and I will help out. Thanks.

Old 02-21-2011, 11:48 AM   #3
Registered: Oct 2010
Distribution: Ubuntu 10.04 , Linux Mint Debian Edition , Microsoft Windows 7
Posts: 390

Rep: Reputation: 50
if there are lots of big files e.g. file>1GB then you have some problems..

though if they are small files perhaps this code might help you. it first checks the exact size and if the sizes match then it continues to check md5sums ... ... prob is it only finds them,,

find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
also this is a script check it out this guy already did the script

EDIT: and also if you are interested in more there are more results in the google search i made

Last edited by silvyus_06; 02-21-2011 at 11:50 AM.
Old 02-21-2011, 12:25 PM   #4
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Check out fdupes.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 04:43 PM
md5sum on a directory with lots of files. solarmax Linux - Software 5 08-11-2005 05:22 PM
how to repair suse md5sum files...? enigmatech Linux - Newbie 3 08-05-2005 11:29 AM
md5sum to check files? serendipitysdc Fedora - Installation 2 06-22-2004 08:12 PM
how to detect duplicate IP gsbarry Linux - Networking 2 02-21-2003 04:28 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration