SFTPスクリプトがすべてのファイルをダウンロードしない

SFTPスクリプトがすべてのファイルをダウンロードしない

BCP11,BCP12,BCP13,BCP14.....BCPXXどのフォルダにBCPDUMPファイルがあるかなど、サーバーフォルダの次の詳細を含むsftpファイルスクリプトがあります。

ファイル名: file_sftp.sh

#!/usr/bin/expect
spawn sftp [email protected]
expect "[email protected]'s password:"
send "password\n"
expect "sftp>"
send "get *Backup/GetBackup/BCP*/*BCPDUMP/20150925/20150925_profile*\n"
expect "sftp>"
send "bye\n"

このスクリプトを実行すると、サーバーには約12個のファイルがありますが、私は1つのファイルのみを取得します。次のスクリプト出力が表示されます。

spawn sftp [email protected]  
Connecting to xx.xxx.x.xxx...  
Password:  
sftp> get *Backup/GetBackup/BCP*/*BCPDUMP/20150925/20150925_profile*  
Couldn't get handle: No such file or directory^M  
Couldn't get handle: No such file or directory^M  
Couldn't get handle: No such file or directory^M  
Fetching   /rsi/Backup/GetBackup/BCP10/BCPDUMP/20150925/20150925_profile_410.list.Z to 20150925_profile_410.list.Z
^M/rsi/Backup/GetBackup/BCP10/BCPDUMP/20150925/20150925_profile_410.list.Z 0%    0     0.0KB/s   --:-- ETA^M/rsi/Backup/GetBackup/BCP10/BCPDUMP/20150925/20150925_profile_410.list.Z                                                           66% 1152KB   1.1MB/s   00:00 ETA^M/rsi/Backup/GetBackup/BCP10/BCPDUMP/20150925/20150925_profile_410.list.Z                                                          100% 1730KB 864.9KB/s   00:02  

ベストアンサー1

ディレクトリを検索しようとしているのでget -r

おすすめ記事