for f in `ssh $SSHCRED "~/file-list.sh"` do rsync --progress --times --partial --append --rsh=ssh -r -h --remove-sent-files $SSHCRED:$f $OUTDIR done
这是我今天做的。
我想通过从ssh $SSHCRED "~/file-list.sh"的输出直接发送到rsync来做到这一点。 这应该会更快,我可以轻松地放弃一个rsync操作。
但是我发现至less有一个问题:远程脚本生成一个包含绝对path的文件列表。 为了使rsync正常工作,我想我需要在每个path之前加上SSH凭证,例如:
user@host:/path/to/file1 user@host:/path/to/file2 user@host:/path/to/file3
这可能吗?
生成一个文件列表,并使用--files-from=FILE选项将它们交给rsync:
rsync --your-options --files-from=filelist.txt user@host:/basedir targetdir
这应该比为每个文件调用rsync快得多。