Exclude files from incremental backup script

When using the incremental backup script, I noticed some files were backupped which should be backuped. In this case some logs files which I don’t have to backup every day. So I changed the script to skip those files.

There are a few solutions for this. I could use grep with the -v parameter. This changes grep to filter instead of search.

For more information about grep, see the manpage of grep

But in this case, I was already using the find command. So I started searching if the find command itself has this functionality, which it did:

find /data/xxx -mtime -1 -type f -not -name "*.log"

This can be expanded with -name [pattern] to keep the files which match the pattern or filter the files which match the pattern with -not -name [pattern] .

For more information about find, see the manpage of find