shell脚本上传文件到ftp服务器,shell脚本实现FTP自动上传文件

-----多个文件-----

#!/bin/bash

ftp -n<

open 172.20.10.242

user logftp logftp

binary

cd /data/ftp/pcidata/pcilogftp/AppFile/log

lcd /data/localacc

prompt

mget *.gz

close

bye

!

----单个文件-----

#!/bin/bash

ftp -n<

open 172.20.10.242

user logftp logftp

binary

cd /AppFile/log

lcd /root

prompt

put install.log

close

bye

!

---脚本---

#!/bin/bash

for LOGPATH in `/bin/cat /fs01/scripts/AMS_LogDir.txt`

do

if [ ! -d ${LOGPATH} ] && [ ${LOGPATH:0:1} != "#" ];then

echo "${LOGPATH} This directory does not exist.Please check it!"

exit 0

fi

done

for UP_LOGPATH in `grep -v "^#" /fs01/scripts/AMS_LogDir.txt`

你可能感兴趣的:(shell脚本上传文件到ftp服务器,shell脚本实现FTP自动上传文件)