Looking for the best way to easily validate the integrity of files/folder in OS X when copied from one location to another.
I've downloaded SuperSFV but it appears to be very slow. Also new to the concept of checksums, so looking for easiest/best practice to ensure that a copied directory or file(s) are identical on the destination as they were on the source.
4 Answers
There is a brew package cksfv which can do the trick. Works on Yosemite.
Install using brew:
brew install cksfvInstall using Boxen, using brew:
# Add this to your Puppetfile:
github "homebrew"
# Add to your personal manifest:
package { 'cksfv': ensure => present }Create a .sfv file:
# one file
cksfv myfile.zip > myfile.zip.sfv
# many files
cksfv file1.zip file2.zip > my-two-files.sfv
# all files
cksfv * > all-files-in-this-dir.sfvVerify a .sfv file:
cksfv -f myfile.zip.sfv You can find the checksum of a file by typing in Terminal :
md5 myfile.extExample :
user1@machine ~ $ md5 myfile.ext
MD5 (myfile.ext) = d7badf415dbd52c2c8b51e564baef8beedit:
For all files in a directory :
for file in * ; do md5 $file; done 3 IIRC digest commands have been invoked slightly different in some versions of OSX. I'm talking like, Tiger as opposed to Snow Leopard, but I still know some people using Tiger. So, just in case 'md5' doesn't work by itself, try:
openssl md5 myfile.ext
[edit]
And, FWIW, I have a bash alias in my .bashrc:
alias md5sum='openssl md5'
It just fits better with my Linux habits.
2I believe the crc32 <FILE> program can be used to get the SFV.
Or you can use:
md5 <FILE>cksum <FILE>