unixrsync

rsync with find in the files-from


I'm trying to transfer files which have been updated in the 31 days. I'm trying to run

/bin/rsync --remove-source-files --files-from="<(find /tmp/rsync/source -type f -mtime -31 -print0)" /tmp/rsync/source /tmp/rsync/destination

However when trying this, i keep receiving the following error:

failed to open files-from file <(find /tmp/rsync/source -type f -mtime -31 -print0): No such file or directory

The directory exists and is accessible.

This is the output of the find:

$ find /tmp/rsync/source -type f -mtime -31  
/tmp/rsync/source/testfile2.txt  
/tmp/rsync/source/testfile.txt  
/tmp/rsync/source/sourcefile.txt

Solution

  • Since i was forced to use a pre-existing script which was parsing on "{" brackets and where you couldn't run commands before the rsync script i was unable to use the above mentioned solutions.

    However i was able to use the following to get it working:

    /bin/rsync --recursive --remove-source-files `find /tmp/rsync/source -type f -mtime -31` /tmp/rsync/destination