Created
September 17, 2020 17:30
-
-
Save gengwg/c7abe2863cc16b308b5b8d3314a927db to your computer and use it in GitHub Desktop.
rsync requesting multiple files from a remote host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
Older versions of rsync required using quoted spaces in the SRC, like these examples: | |
rsync -av host:'dir1/file1 dir2/file2' /dest | |
rsync host::'modname/dir1/file1 modname/dir2/file2' /dest | |
This word-splitting still works (by default) in the latest rsync, but is not as easy to use as the first method. | |
If you need to transfer a filename that contains whitespace, you can either specify the --protect-args (-s) option, | |
or you'll need to escape the whitespace in a way that the remote shell will understand. For instance: | |
rsync -av host:'file\ name\ with\ spaces' /dest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment