当前位置: 动力学知识库 > 问答 > 编程问答 >

rsync multiple remote directories to local machine preserving directory paths

问题描述:

Would I be able to use rsync as such:

rsync -e ssh [email protected]:/path/to/file:/path/to/second/file/ /local/directory/

or would i have to do something else?

网友答案:

Directly from the rsync man page:

The syntax for requesting multiple files from a remote host is done
by specifying additional remote-host args in the same style as the 
first, or with the hostname omitted.  For instance, all these work:

    rsync -av host:file1 :file2 host:file{3,4} /dest/
    rsync -av host::modname/file{1,2} host::modname/file3 /dest/
    rsync -av host::modname/file1 ::modname/file{3,4}

This means your example should have a space added before the second path:

rsync -e ssh [email protected]:/path/to/file :/path/to/second/file/ /local/directory/

I'd suggest you first try it with the -n or --dry-run option, so you see what will be done, before the copy (and possible deletions) are actually performed.

分享给朋友:
您可能感兴趣的文章:
随机阅读: