Recursively md5sum all files in a directory tree
After a server crash a wanted to compare all actual files with the backuped data. An easy way is to compare the md5 hashes like that:
First create recursively md5 hashes from all files in that directory:
find ./backup -type f -print0 | xargs -0 md5sum > /checksums_backup.md5 |
Then check the actual data:
md5sum -c checksums_backup.md5 |
I was lucky, no files where damaged.
Share This
After a server crash a wanted to compare all actual files with the backuped data. An easy way is to compare the md5 hashes like that: First create recursively md5...
— Trackback URI
This entry (permalink) was posted on Saturday, October 25, 2008, at 11:31 am by Michael, tagged with Linux, Shell and categorized in English posts, Shortcuts.
The following post could be of some interest: Find all non “.java” files but not in .svn directories, Find all files that changed in the last 24hours, Enabling tooltips on a JTree, Grails 0.6: Modifying JavaScript Libraries, Using rubyzip to create zip files on the fly, Apache httpd, Tomcat und sendfile, Batchconvert ascii to utf8, Copy directories and preserve permissions, On installing Windows Vista, Preparing for Rails 2.3.9
3 Comments
find ./backup -type f -exec md5sum {} \;>> /checksums_backup.md5
Läuft meiner Erfahrung nach oft schneller als xargs. Vielleicht in diesem Falle nicht ganz so relevant, aber für andere Fälle
Danke
Ich hoffe, ich brauch’s nicht so schnell wieder.
why when used md5sum i encountered to no such file or directory!?,…
#!/bin/sh
chksumfile=’tmp’
`md5sum -c “$chksumfile”`
———————-
# sh verifychksum.sh
verifychksum.sh: line 3: chksum/ss/RecoverDataLinuxTrial.tar.gz:: No such file or directory
================================
while when i run command line :
# md5sum -c tmp
chksum/ss/RecoverDataLinuxTrial.tar.gz: OK
chksum/ss/zziplib-0.13.49-8.fc12.i686.rpm: OK
chksum/RecoverDataLinuxTrial.tar.gz: OK
chksum/zziplib-0.13.49-8.fc12.i686.rpm: OK
chksum/s: OK
chksum/chsum: OK
One Trackback/Pingback
[...] support going through each folder and checksuming each file and outputting the sums. Sure there are one line shell scripts/commands you can run but I was really looking for a way that would not require hacking about. I finally found what I was [...]
Post a Comment