LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Home Forums HCL Reviews 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 08-10-2005, 12:25 PM   #1
solarmax
LQ Newbie
 
Registered: Nov 2004
Location: London, UK
Distribution: Ubuntu 6.06 Dapper Drake
Posts: 11

Rep: Reputation: 1
md5sum on a directory with lots of files.


Hi all,
I have been using linux for few years now. I found all the required answers by searching forums. I need to solve the following problem.

I have a folder (lets call it music) with lots of sub-folders in it (lets call it albums) , which has lots of files in each of them (they are music tracks). I have backed up my main music folder. Basically, I copied music folder to another hard disk. I want to md5sum the backup.

When i do the following command:
Code:
md5sum songs
it says:
Quote:
error processing songs: failed in buffer_read(fd): mdfile: Is a directory
I understand that md5sum only works for a file. Its unrealistic to check sums of each and every file separately.

long story short, how do i check md5sums for files in a folder recursively and print it out to a text file?
please tell me the name of the program. or any other method to do the job.

Thank you..

PS : I apologies in advance if this has been posted before..

Ubuntu linux 5.04.
kernel 2.6.10-5-k7
AMD AthlonXP 3000+
WinTV-PCI hauppauge TV card bt848
Mother board: ASUS some version
8mbps broadband..
yes 8mbps broadband.
 
Old 08-10-2005, 12:33 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Code:
find songs -type f | xargs md5sum
Where songs is the directory. That *SHOULD* work for you.
 
Old 08-10-2005, 12:38 PM   #3
solarmax
LQ Newbie
 
Registered: Nov 2004
Location: London, UK
Distribution: Ubuntu 6.06 Dapper Drake
Posts: 11

Original Poster
Rep: Reputation: 1
thanks for the quick reply..

when i input your code.. it says :
Quote:
xargs: unmatched single quote
i get something is wrong..
 
Old 08-10-2005, 01:46 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Hrrm, are you sure you copied my command line exactly? Do some of the files contain single quotes?

Try:
Code:
find songs -type f | xargs -i md5sum "{}"
 
Old 08-11-2005, 05:34 PM   #5
solarmax
LQ Newbie
 
Registered: Nov 2004
Location: London, UK
Distribution: Ubuntu 6.06 Dapper Drake
Posts: 11

Original Poster
Rep: Reputation: 1
Thank you very much Matir.. yes I do have some names with quote. Your code worked like a charm.

Quote:
find songs -type f | xargs -i md5sum "{}"
If someone else is reading this, i added the " > music.txt " at the end to print it in a text file. it is useful when you have several files to md5sums.

Code:
find songs -type f | xargs -i md5sum "{}" > music.txt
thanks again,
 
Old 08-11-2005, 06:22 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Yep. Or, of course, you could pass it off to a sort program, or whatever you wanted.

Glad it worked for you.
 
  


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
comparing lots of files Frustin Linux - General 4 09-22-2005 03:54 PM
how to repair suse md5sum files...? enigmatech Linux - Newbie 3 08-05-2005 12:29 PM
Renaming lots of files Tuttle Linux - General 4 11-18-2004 12:15 PM
md5sum to check files? serendipitysdc Fedora - Installation 2 06-22-2004 09:12 PM
wiped out lots of files :( skull_crusher Linux - Newbie 0 04-10-2003 05:10 AM

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

All times are GMT -5. The time now is 04:32 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration