ftp发送文件

时间:2021-08-31 03:15:18
#!/bin/bash
#author:luyongjin
IP=220.250.65.22
USERNAME='ftp_hangye20'
PASSWORD='oUo2JD7oK#u-epw'
#DATE=`date -d'-1 day' +'%Y%m%d'`
DATE=$(date +%Y%m%d)
echo $DATE
DIR=/tpdata//$DATE log_file="/tpdata/46/logs/"$DATE.log
echo $log_file
echo "begin##############"$DATE >> $log_file if [ -e $DIR ] ; then #ftp -n<<!
/usr/bin/ftp -n<<!
open $IP
user $USERNAME $PASSWORD
binary
hash
cd /data
lcd $DIR
prompt
mput *
close
bye
!
fi
#!/bin/sh

ServerIP="10.46.248.44"
USER="lmtrans"
USER_PW="lmtrans"
Put_File="test.txt"
Put_dir="/home/disk6/lmtrans"
Local_dir="/home/audio/data.wget/hz01-sys-ravs140.hz01.baidu.com/home/audio/lishilong/speech_stat/hotword/test"
ftp -n $ServerIP <<End-Of-Session #标记符号
user $USER $USER_PW
cd $Put_dir #进入到目的服务器的相应目录
lcd $Local_dir #进入到本地目录
binary # 二进制文件格式传送
put $Put_File #传送文件
bye #结束会话
End-Of-Session