简体   繁体   English

如何从多个目录中提取多个文件,而不同目录中的不同文件可能具有相同的名称

[英]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.

相关问题 自动将SCP复制文件从多个目录(放在方括号中)复制到适当的目录 - Automate SCP copy files from multiple directories (in brackets) to appropraite directories 如何检查名称相同但扩展名不同的目录中的文件 - How to check files in different directories with same name but different extensions 将多个目录中的多个文件从服务器复制到本地,文件进入与服务器同名的目录 - Copying multiple files in multiple directories from server to local, with files going into directories with the same name as server Linux在不同目录中重命名具有相同文件名的多个文件 - Linux Rename multiple files with same filename throughout different directories 如何使用find重命名具有相同名称的不同目录中的文件 - How to rename files in different directories with the same name using find 如何在多个不同目录中移动许多文件(在Linux上) - How to move many files in multiple different directories (on Linux) 如何在从多个目录/文件编译内核模块的同时创建新目录并向其中移动.o文件 - How to create new directories and move .o files to it while compiling a kernel module from multiple directories/files 如何从不同目录中归档特定文件? - how to archive specific files from the different directories? 按数字升序组合同名但在不同目录中的文件 - Combine files of same name, but in different directories, in numerically ascending order 连接不同目录中同名文件的更快方法 - Faster way to concatenate files of same name in different directories
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM