I am attempting to pull everything from a remote directory which is more then ten minutes old, and then remove the source files.
My remote find seems to be working (tested independently on the remote box), but when rsync goes to use it, my user's home path is being prefixed to the find output, like so:
rsync -avz --dry-run --remove-source-files --files-from=<(ssh spot@host "find /mnt/volume_2/partners/test/uploads/ -amin +10 -type f,d -print0") spot@host:. .
receiving incremental file list
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1054" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1105" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1105/subfile-1105" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1101" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1056" failed: No such file or directory (2)
rsync: [sender] link_stat "/home/spot/mnt/volume_2/partners/test/uploads/file-1058" failed: No such file or directory (2)
I've spent more time than I'd like to admit attempting to resolve this with no success. I am hoping someone here is nice enough to point me in the right direction.
Thank you!
rsync is looking at the wrong place, because those paths are relative (from the rsync man page, emphasis mine):
Either send absolute paths to the files-from option, but do not additionally define a source directory other than the root (/). This should work - I replaced one character after the host name:
Or - and especially useful when you actually want to deal with relative paths in the destination - tell find to emit relative paths and actually use them:
Note I switched the
<()
redirection to a normal|
pipe for better interoperability and less surprises while escaping the command for inclusion in scripts. I also added--from0
on top of your comment because the input is now null-delimited so it makes sense to tell rsync it is so.