|
|

Shell FTP 上传文件脚本 beiyue 发表于 2010/2/26 11:04:00 |
上传一个文件的脚本:
#! /bin/bash
FTP_SERVER=10.8.0.129
USER="loglogic"
PASSWORD="log1234"
FTP_PATH="/zhu"
LOCAL_PATH="/home/test"
if test -f /$LOCAL_PATH/login.sh
then
# file exits, so upload and print a message.
ftp -i -n $FTP_SERVER < user $USER $PASSWORD
passive
binary
cd /$FTP_PATH
lcd /$LOCAL_PATH
put login.sh # file name
AUTO_PATH
echo "Done!"
else
# file doesn't exit, so we print a message and exit.
echo "This file doesn't exit."
exit
fi
上传多个文件的脚本:
#! /bin/bash
# This script is for upload all files as same directory to FTP Server.
FTP_SERVER=10.8.0.129
USER="loglogic"
PWD="log1234"
FTP_PATH="/zhu"
LOCAL_PATH="/home/test"
ftp -i -n $FTP_SERVER < user $USER $PWD
passive
binary
cd /$FTP_PATH
lcd /$LOCAL_PATH
mput *
AUTO_PATH |
|
发表评论:
|
|