我有找到最后修改的文件并发送到 ftp 服务器的代码,但名称不一样。如何以相同的名称将文件发送到 ftp?
#!/bin/bash
filename=$(find /home/local/server/ -mmin -120 -name '*.csv.gz')
hostname="192.168.5.11"
username="user"
password="pass"
echo "Send file $filename to the server $hostname"
ftp -n $hostname <<END_SCRIPT
quote USER $username
quote PASS $password
passive
ascii
put $filename /home/remote/server/file_name_found_on_local_server
quit
END_SCRIPT