recursive md5sum check

so I have within my script a little md5sum check...

find . ! -type d -print0 | xargs -0 md5sum

And I want it to compare the generated values against a file so I'm trying...

find . ! -type d -print0 | xargs -0 md5sum -c files.md5

I generated this file by redirecting the output of the first version to 'files.md5' but the second version gives me this error...

usage: md5sum [-bv] [-c [file]] | [file...]
Generates or checks MD5 Message Digests
    -c  check message digests (default is generate)
    -v  verbose, print file names when checking
    -b  read files in binary mode
The input for -c should be the list of message digests and file names
that is printed on stdout by this program when it generates digests.

I wonder if I should be setting an array to equal the values and checking manually with a 'for x in @array' please let me know what you think.

You only need to provide the original file as the input to --check (-c), it obtains the fiilenames to check from that file.

i.e. just:

md5sum -c files.md5

K, that makes sense. Thank you
:slight_smile: