我可以这样使用rsync:
rsync -e ssh root@remote.com:/path/to/file:/path/to/second/file/ /local/directory/
Run Code Online (Sandbox Code Playgroud)
还是我必须做别的事?
Ton*_*nin 54
直接来自rsync手册页:
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}
Run Code Online (Sandbox Code Playgroud)
这意味着您的示例应在第二个路径之前添加空格:
rsync -e ssh root@remote.com:/path/to/file :/path/to/second/file/ /local/directory/
Run Code Online (Sandbox Code Playgroud)
我建议你首先使用-nor --dry-run选项进行尝试,这样你就可以在实际执行复制(和可能的删除)之前看到将要做什么.
只是@tonin的实际示例。从实时服务器下载特定目录
rsync -av root@123.124.137.147:/var/www/html/cls \
:/var/www/html/index.php \
:/var/www/html/header.inc \
:/var/www/html/version.inc.php \
:/var/www/html/style.css \
:/var/www/html/accounts \
:/var/www/html/admin \
:/var/www/html/api \
:/var/www/html/config \
:/var/www/html/main \
:/var/www/html/reports .
Run Code Online (Sandbox Code Playgroud)