LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-21-2004, 03:13 PM   #1
LavaDevil94
LQ Guru
 
Registered: Jul 2003
Distribution: Gentoo 2004.2: Who needs exmmpkg when you have emerge?
Posts: 1,795

Rep: Reputation: 47
Question How do you do a recursive check of md5sums?


I'm trying to get the md5sums the contents of a directory, but md5sum doesn't seem to have a -r option. Since there are directories inside the directory in question, I have to do this recursively, but I can't find out how. Any ideas?
 
Old 07-21-2004, 03:32 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Try this... go to the base directory (i.e. if the files you want to sort are in /home/joe/files then cd to there) and then run:
Code:
 for i in `find . "*"` ; do md5sum $i; done
Note that that's a backtick (below escape on a US keyboard) around the find command, which includes an asterisk in quotemarks.

This will only list the m5sums for this files and print the filename, it won't compare the sum to anything else, but if you have a list of correct sums then perhaps you can run diff or something? You could always redirect the output to a file or to less if it scrolls off screen. Anyway, perhaps this will be of some help.
 
Old 07-21-2004, 03:34 PM   #3
RobertP
Member
 
Registered: Jan 2004
Location: Manitoba, Canada
Distribution: Debian
Posts: 454

Rep: Reputation: 32
Piece of cake!
Suppose the directory you wish to sum is /whateverpath/yourdir
md5sum /whateverpath/yourdir/* >> md5sums.txt

will sum every file in the directory and place the sum for each file in the output file md5sums.txt

Of course, you can vary this command. You could use *.iso to do only files ending in .iso, for instance. You could keep adding files to the dir and md5sum /whateverpath/yourdir/newfile >>md5sums.txt
would add the result to the end of the original list. You could use one > to completely rewirte md5sums.txt You could cd to the directory, first , too.
cd /whateverpath/yourdir
md5sum *August*.iso >>md5sums.txt

and you could verify that the files had not been fudged by doing
md5sum -c md5sums.txt
For the greatest certainty, keep md5sum executable and the md5sums.txt in a readonly file like a CD.

Recursion can be done one level at a time:
md5sum *>>md5sums.txt
md5sum */* >> md5sums.txt and so on or you can tar the files and md5sum the result.


Has this been overkill?

Last edited by RobertP; 07-21-2004 at 03:42 PM.
 
Old 07-21-2004, 03:40 PM   #4
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Quote:
Originally posted by RobertP

Has this been overkill?
No, because you didn't read the question - he needs to do it RECURSIVELY. The command you specified will only work for the files in the current directory, it won't recurse subdirectories.
 
Old 07-21-2004, 03:53 PM   #5
LavaDevil94
LQ Guru
 
Registered: Jul 2003
Distribution: Gentoo 2004.2: Who needs exmmpkg when you have emerge?
Posts: 1,795

Original Poster
Rep: Reputation: 47
I'll try these. Thanks guys .
 
  


Reply



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
Le 2005 md5sums? equinox Mandriva 3 04-21-2005 10:24 AM
Should md5sums match? TSloth Mandriva 3 11-12-2003 11:33 PM
MD5SUMS for Mandrake 9.2 crox Mandriva 5 10-20-2003 10:10 AM
md5sums Culbert Linux - General 2 04-09-2003 10:35 AM
MD5Sums NSKL General 1 08-04-2002 04:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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