如何将它们写成一行,也不重复相同的路径?
rsync -a root@somewhere:/folder/remote/*.txt .
rsync -a root@somewhere:/folder/remote/*.jpg .
Run Code Online (Sandbox Code Playgroud)
Ger*_*ert 19
我会这样写:
rsync -a root@somewhere:/folder/remote/*.{txt,jpg} .
Run Code Online (Sandbox Code Playgroud)
Gil*_*il' 14
rsync -a --include='*.txt' --include='*.jpg' --exclude='*' root@somewhere:/folder/remote/ .
Run Code Online (Sandbox Code Playgroud)
(注意最后的/
in/folder/remote/
和--exclude='*'
包含规则之后的位置很重要。)在支持大括号扩展的 shell 中(例如 bash、ksh、zsh):
rsync -a --include='*.'{txt,jpg} --exclude='*' root@somewhere:/folder/remote/ .
Run Code Online (Sandbox Code Playgroud)
--include='*/' --prune-empty-dirs
如果您还想复制子目录中的文件,请添加。
归档时间: |
|
查看次数: |
18355 次 |
最近记录: |