近来由于需要频繁的从服务器上下载log文件,利用ftp工具感觉效率底下,所以就自己动手写了一个bat来完成ftp下载操作!
@ECHO OFF
ECHO Clear C:\Users\Administrator\Desktop\logs
del C:\Users\Administrator\Desktop\logs\*log*
ECHO Get CMS CSG AS log files from 192.168.6.75, user is viss!
set ftpconfname=autoftp.tmp
echo open 192.168.6.75 >"%ftpconfname%"
echo root>>"%ftpconfname%"
echo root>>"%ftpconfname%"
echo asc >>"%ftpconfname%"
echo lcd C:\Users\Administrator\Desktop\logs >>"%ftpconfname%"
echo cd /usr/local/tomcat6/logs >>"%ftpconfname%"
echo prompt >>"%ftpconfname%"
echo mget *cms* *csg* *as* >>"%ftpconfname%"
echo bye >>"%ftpconfname%"
ftp -s:"%ftpconfname%"
del "%ftpconfname%"
ECHO Get RUS log files from 192.168.6.75, user is rus!
echo open 192.168.6.75 >"%ftpconfname%"
echo admin>>"%ftpconfname%"
echo admin>>"%ftpconfname%"
echo asc >>"%ftpconfname%"
echo lcd C:\Users\Administrator\Desktop\logs >>"%ftpconfname%"
echo cd ./tomcat6/logs >>"%ftpconfname%"
echo prompt >>"%ftpconfname%"
echo mget *rus* >>"%ftpconfname%"
echo bye >>"%ftpconfname%"
ftp -s:"%ftpconfname%"
del "%ftpconfname%"
PAUSE
需要注意的地方是:
登录ftp的用户名和密码后面不能出现空格,否则登录失败