I have this file structure:
...folders/to/copy
...folders/to/mirror
I've been doing:
rsync --ignore-existing -raz --progress $source $destination
This is serving well for the purpose of keeping everything up to date on both folder trees. But now I have the need to do this only for files that have been changed more than 24 hours ago. I have tried something like this:
rsync -rav `find $source -mtime 1` $destination
The problem is this messes up the file tree and doesn't work as I need. Is there a better way to do this?
I want to backup the file structure, using the relative paths say from "folders" and everything in it, from one place to another leaving only files older than 24 hours (mtime
).
find $source -mtime 1
lists files and directories and links and sockets and ... which were "modified" between 24 hours and 48 hours ago. You probably don't want to list directories, and you may not want to have the 48 hour restriction as well. – icarus Mar 07 '22 at 16:27find
adds any directories, the rsync will run all the items underneath. You'd at least want to turn that off. – BowlOfRed Mar 08 '22 at 00:29