[英]how to scp multiple files from multiple directories, while different files in different directories may have the same name
I want to scp several files from remote to local, the files in remote is like this: 我想将多个文件从远程复制到本地,远程文件如下所示:
/data/1792348/a.stat /data/1792348/a.stat
/data/1792348/b.stat /data/1792348/b.stat
/data/187657/a.stat /data/187657/a.stat
/data/187657/b.stat /data/187657/b.stat
... ... ……
1792348 187657 etc, the middle directory name is random. 1792348 187657等,中间目录名称是随机的。
how can i scp all the files ends with .stat from remote to local? 如何从远程到本地scp所有以.stat结尾的文件?
if i tried scp -P36000 user@host:/data/ /*.stat .*, i can only get 2 files a.stat b.stat . 如果我尝试了scp -P36000 user @ host:/ data / /*.stat。*,我只能得到2个文件a.stat b.stat 。
why i can's submit this question? 为什么我可以提交这个问题?
i really don't know how to solve this, and hadn't search a answer from google. 我真的不知道如何解决这个问题,也没有从Google搜索答案。
i would use rsync
(which uses scp internally; but is way more elaborate, eg it will only transmit minimal changesets of data, so if you run it several times, you will get an impressive speedup) 我会使用
rsync
(内部使用scp;但是更加复杂,例如,它将仅传输最小的数据变更集,因此,如果您多次运行它,将获得令人印象深刻的加速)
rsync -avz /data/ \
--include "*/" --include "*.stat" --exclude "*" \
user@host:/path/to/dest/data/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.