用shell寫的ftp工具

#!/bin/shshell


SRCFILEPATH=$1code

#DESFILEPATH=$2xml

if [ $# != 4 ];thenip

echo "USAGE:$0 ip username password destpath"it

exitclass

fiawk

while [ true ]ftp

dofile

#if [ ! -f *.xml ];thensort

#sleep 1

#continue

#fi

ls *.xml | sort -u >file.list

size=`du -s file.list | awk '{print $1}'`

if [ $size -eq 0 ];then

usleep 100

continue

fi

while read file

do

FTP=`ftp -n<<!

open $1 

user $2 $3 

bin

cd $4

put ${file}

close

bye

!`

FTPSIZE=`echo "$FTP"|awk '{print length($0)}'`

if [ "$FTPSIZE" != "0" ];then

usleep 100

#continue

break

fi

rm -f $file

usleep 100

done<file.list

done

相關文章
相關標籤/搜索