Linux使用scp拷贝多个文件到远程服务器

时间:2022-04-04 17:38:49

使用scp复制多个文件根据文件传输方向的不同,可以分为两种情况:

  • 远程服务器拷贝多个文件到本地
  • 本地上传多个文件到远程服务器

1、远程服务器拷贝多个文件到本地

$ scp username@remote.com:/from/path/\{a,b,c\} ./

2、本地上传多个文件到远程服务器

$ scp foo.txt bar.txt username@remote.com:~
$ scp {foo,bar}.txt username@remote.com:~
$ scp *.txt username@remote.com:~