简单SHELL脚本实现FTP上传文件

#!/usr/bin/ksh

if [ $# -ne 5 ]
then
   echo "Usage: DestIPAddress,userName,PassWord,SrcPath,DestPath"
   exit
fi

DestIPAddress=$1
userName=$2
PassWord=$3
SrcPath=$4
DestPath=$5

echo $DestPath

if [ ! -d "$SrcPath" ]
then
   echo "Check if $SrcPath is valid or not"
fi

cd $ScrPath;
for file in ./*.txt
do
echo $file
ftp -v -n $DestIPAddress << EOF
user $userName $PassWord
ascii
cd $DestPath
lcd $SrcPath
put $file
bye
EOF

done

 


版权声明:本文为cancan8538原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。