Suppress rsync warning: some files vanished before they could be transferred

rsync

I get loads of warnings when backing up my running Postfix and Courier server files like:

file has vanished: /var/kunden/mail/username/name@mymail.de/tmp/courier.lock

How do I suppress those warnings from rsync when running it from Cron /usr/bin/rsnapshot hourly?

Can I somehow exclude those dirs?

/var/kunden/mail/*/*/tmp/

the tmp folder can be deeper as well, for example:

file has vanished: /var/kunden/mail/username/name@mymail.de/.Presse/tmp/1353871473.M716135P32214_imapuid_36.test.de
file has vanished: /var/kunden/mail/username/name@mymail.de/.Presse/tmp/courier.lock

Best Answer

You can use rsync's exclude switch (--exclude):

$ rsync -avz --exclude '**/tmp/' source/ destination/

Specified this way --exclude '**/tmp/' will ignore any path which includes the string /tmp/. You can provide patterns to this arguments as well.

Example

$ rsync -avz --exclude '/path/to/*/tmp/' source/ destination/

Will exclude on paths of the form: /path/to/*/tmp/.