scp 或 sftp 使用单个命令复制多个文件 [英] scp or sftp copy multiple files with single command
本文介绍了scp 或 sftp 使用单个命令复制多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将文件从/复制到不同目录中的远程服务器.比如我想一次运行这4个命令.
I'd like to copy files from/to remote server in different directories. For example, I want to run these 4 commands at once.
scp remote:A/1.txt local:A/1.txt
scp remote:A/2.txt local:A/2.txt
scp remote:B/1.txt local:B/1.txt
scp remote:C/1.txt local:C/1.txt
最简单的方法是什么?
推荐答案
从远程复制多个文件到本地:
Copy multiple files from remote to local:
$ scp your_username@remote.edu:/some/remote/directory/\{a,b,c\} ./
从本地复制多个文件到远程:
Copy multiple files from local to remote:
$ scp foo.txt bar.txt your_username@remotehost.edu:~
$ scp {foo,bar}.txt your_username@remotehost.edu:~
$ scp *.txt your_username@remotehost.edu:~
从远程复制多个文件到远程:
Copy multiple files from remote to remote:
$ scp your_username@remote1.edu:/some/remote/directory/foobar.txt \
your_username@remote2.edu:/some/remote/directory/
来源:http://www.hypexr.org/linux_scp_help.php
这篇关于scp 或 sftp 使用单个命令复制多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文