Unix sftp - mput command - transfer all files with a specific prefix
问题 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? 回答1: If your files all in current directory: sftp user@server << EOF cd /destination $(for i in ABC* XYZ*; do echo "put $i"; done) EOF Output (example): 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