Unless you intentionally delete files periodically from /bck/mikrotik
that are still present on the source system, or you have many thousands of files and you're seeing a time impact while rsync
skips the files it's already transferred, your date filter shouldn't be necessary.
However, having said that you can use find
to generate the set of candidate files for transfer. Here we're considering only files that have been created/modified within the last seven days:
ssh -n [email protected] 'cd /home/mikrotik && find . -type f -mtime -7 -print0' |
rsync -av --files-from='-' --from0 [email protected]:/home/mikrotik /bck/mikrotik/
If you don't have a version of find
that supports -print0
, replace it with -print
and remove --from0
from the rsync
. The difference is that you then won't be able to copy files containing an embedded newline in their name
rsync
alone. BTW, you don't need-e ssh
as SSH is the default. And-r
is already activated by-a
, so you can drop that as well./bck/mikrotik
that are still present on the source system, or you have many thousands of files and you're seeing a time impact whilersync
skips the files it's already transferred, your date filter shouldn't be necessaryfind -mtime -7
as a filter before the copy process to get files created/modified during the last 7 days.