The parameter after -cnewer-cnewer could be your problem:
find is supposed to find files newer than the filedate of the file given after -cnewer. Seems you put a directory.
So the first part should be:
find 'path/to/backup' -type f -cnewer '/path/to/checksum.md5'
findis supposed to find files newer than the filedate of the file given after -cnewer.- Seems you put a directory.
So the first part should be:
find 'path/to/backup' -type f -cnewer '/path/to/checksum.md5'
The second part is the exec function. From man find you get:
-exec command {} ; executes the command (in your case: md5sum) where the string `{}' is replaced by the current file name. The specified command is run once for each matched file.
-exec command {} + runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. If find encounters an error, this can sometimes cause an immediate exit, so some pending commands may not be run at all.
So a problem could be that there are too many files, or during executing find, there is an error.
From
man findyou get:-exec command {} ;executes the command (in your case:md5sum) where the string{}is replaced by the current file name. The specified command is run once for each matched file.-exec command {} +runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. Iffindencounters an error, this can sometimes cause an immediate exit, so some pending commands may not be run at all.So a problem could be that there are too many files, or during while
find, there is an error.
I hence recommend:
# Delete file /path/to/appended_checksum.md5 as we 'add' text to it.
rm /path/to/appended_checksum.md5
find 'path/to/backup' -type f -cnewer '/path/to/checksum.md5' -exec md5sum {} \;>> '/path/to/appended_checksum.md5'
sort -k 2 -u '/path/to/checksum.md5' '/path/to/appended_checksum.md5' > path/to/new_checksum.md5