Rsync directory error

I wanted to copy files that are made 15 and more days ago. Here is the code im currently using

rsync -RDa0P \
    --files-from=<(find /vmail/folder1/ -mtime +15 -print0) \
    . [email protected]:/vmail/folder1/

The find part did show all the files:

/vmail/folder1/folder11/file15,
/vmail/folder1/folder11/file16

but when the code above is issued, it gives an error failed: No such file or directory (2). And the directory was changed, root was added :

rsync: link_stat "/root/vmail/folder1/folder11/cur/ failed: No such file or directory (2)"

Am i missing something? Any help is appreciated!


Solution 1:

You should pipe your file list:

find /vmail/folder1 -mtime +15 -printf '%P\0' | \
rsync -vRDa0P --files-from=- /vmail/folder1 [email protected]:/vmail/folder1