3

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 4

6

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
3

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
  • how would I process an entire folder? Jul 28, 2010 at 23:15
  • 1
    for file in * ; do md5 $file; done
    – Kami
    Jul 28, 2010 at 23:22
  • 1
    Thanks - now how do I (simply) run and compare it on the destination once copied? Jul 29, 2010 at 1:51
0

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
  • "digests have changed in some versions of OSX" are you mad ? MD5 is a well defined hash algrorithm ! It will be full of nonsense to change it !
    – Kami
    Jul 30, 2010 at 13:36
  • Ugh. Sorry. Totally not what I meant. What I mean is that digest commands changed. I seem to remember a day when a bare md5 command at the standard command line didn't work, and you had to do openssl md5 file.ext, or, openssl then md5 file.ext at the OpenSSL> prompt.
    – VxJasonxV
    Aug 2, 2010 at 23:47
0

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

Or you can use:

  • md5 <FILE>
  • cksum <FILE>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .