ftp shell扫描目录上传脚本

来源:互联网 发布:党规党纪面前知敬畏 编辑:程序博客网 时间:2024/06/05 14:36
#!/bin/sh


upload(){
ftp -n<<EOF
open 192.168.0.51
user  gong 123456
binary
hash
lcd $1
prompt
mput *
close
EOF
}


# ......
foreachd(){
# ....1
for file in $1/*
do
# ......................
if [ -d $file ]
then
echo $file
upload $file
foreachd $file
#elif [ -f $file ]
#then
#echo $file
#foreachd $file
fi
done
}


# .........................
if [ $# != 0 ]
then
    foreachd "$1"
else
    foreachd "."
fi
原创粉丝点击