#!/bin/bash
echo "doing ftp transfer..."
#change 'dir'
(find ${HOME} -depth -maxdepth 1 -type d -exec basename {} ';' | grep -v '^\.\|`basename ${HOME}`') | while read line ; do
#change max process numbers. default number 10
while ((`pidof ftp | wc -w` >=10 )) && [ -d ${line} ]; do
sleep 2
done
echo "!" >/tmp/ftptmp.${line}
#change 'ip addr'
echo "open 192.168.1.196" >>/tmp/ftptmp.${line}
#change 'username' and 'passwd'
echo "user username passwd" >>/tmp/ftptmp.${line}
echo "bin" >>/tmp/ftptmp.${line}
echo "prompt off" >>/tmp/ftptmp.${line}
echo "cd ${line}" >>/tmp/ftptmp.${line}
echo "lcd ${line}" >>/tmp/ftptmp.${line}
echo "mput *" >>/tmp/ftptmp.${line}
echo "close" >>/tmp/ftptmp.${line}
echo "bye" >>/tmp/ftptmp.${line}
echo "!" >>/tmp/ftptmp.${line}
ftp -nv
sleep 2
done
while !((`pidof ftp | wc -w` <1)); do
sleep 2
done
rm -rf /tmp/ftptmp.*
echo "transfer finished"
阅读(3308) | 评论(0) | 转发(0) |