Unix sftp-mput命令-传输具有特定前缀的所有文件 [英] Unix sftp - mput command - transfer all files with a specific prefix

查看:437
本文介绍了Unix sftp-mput命令-传输具有特定前缀的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目录中有一堆文件.但是我只想将以ABCXYZ开头的文件传输到SFTP服务器.如何在mput命令中过滤这些内容?

I have bunch of files in a directory. But I would like to transfer to SFTP server only files starting with either ABC or XYZ. How do I filter these in my mput command?

推荐答案

如果文件全部在当前目录中:

If your files all in current directory:

sftp user@server << EOF
cd /destination
$(for i in ABC* XYZ*; do echo "put $i"; done)
EOF

输出(示例):


Connected to server.
sftp> cd /destination
sftp> put ABCfoo.txt
Uploading ABCfoo.txt to /destination/ABCfoo.txt
ABCfoo.txt                                                                100%    0     0.0KB/s   00:00    
sftp> put XYZfoo.txt
Uploading XYZfoo.txt to /destination/XYZfoo.txt
XYZfoo.txt                                                                100%    0     0.0KB/s   00:00  

这篇关于Unix sftp-mput命令-传输具有特定前缀的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆