我正在使用遞歸搜索SAN上的目錄查找具有比4小時更新的特定文件名的文件的Bash腳本(請參見下文)。然後將所有這些文件複製到特定的FTP位置並通過電子郵件發送,以表明副本已完成。該腳本工作正常,只是它只複製頂級目錄中的文件。我在較低目錄得到的錯誤是這樣的:BASH遞歸查找文件名並複製到ftp
#remote: -v
ftp: local: -v: No such file or directory
local: ./Test01/test02/folder02_01_1200_m30.mp4 remote: ./Test01/test02/folder02_01_1200_m30.mp4
229 Entering Extended Passive Mode (|||45127|)
550 ./Test01/test02/folder02_01_1200_m30.mp4: File does not exist. (2)
221 Goodbye.
#
這裏是腳本
#!/bin/bash
#The location from where the script should search
GSPORIGIN='/Volumes/folder01/folder02'
#File Names to be moved
FILE1='*1200_m30.mp4'
#FTP Details
HOST='xxxx.upload.com'
USER='xxxxxxx'
PASSWD='xxxxxxxxxxxx'
#the destination directory on the FTP
DESTDIR="/8619/_!/TEST"
# Go to the location from where the search should start
cd $GSPORIGIN
for file in `find . -type f -name "*1200_m30.mp4" -mmin -240`
do
echo $file
if [ -f $file ] ; then
ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd $DESTDIR
mput -v $file
EOT
echo "$file has been copied to FTP" | mail -s "$file has been copied to FTP in Directory $DESTDIR" [email protected];
else exit 1
fi
done
感謝您的快速回復 - 當我運行腳本時會創建目錄,但無法移動文件:./Test_1200_m30.mp4 嘗試96.7.36.11 ... 已連接到ftp.xxxxxxxxx.net 。 220內容存儲FTP服務器 530請用USER和PASS登錄 331 XXXXX所需的密碼。 230用戶stor_admin登錄。 遠程系統類型是UNIX。 使用二進制模式傳輸文件。 交互模式關閉。 250 CWD命令成功。 550。:禁止文件名(4) 250 CWD命令成功。 用法:put local-file [遠程文件] 221再見。 ./Test_1200_m30.mp4 – JRM
好的只是修復了它 – JRM
修復程序是mput -v $文件$ filename – JRM