Looking for OS X utility to verify/validate copied files/directories - checksum / SFV / MD5

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 cksfv

Install 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.sfv

Verify a .sfv file:

cksfv -f myfile.zip.sfv

You can find the checksum of a file by typing in Terminal :

md5 myfile.ext

Example :

user1@machine ~ $ md5 myfile.ext
MD5 (myfile.ext) = d7badf415dbd52c2c8b51e564baef8be

edit:

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.

2

I believe the crc32 <FILE> program can be used to get the SFV.

Or you can use:

  • md5 <FILE>
  • cksum <FILE>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like