现在我A服务器F:\backup下有一批文件,每天都会新增,现我想把每天新增的这个文件上传到FTP服务器F:\backup\Tools\目录上去,FTP服务器信息如下:
IP:192.168.2.50
账号:backup
密码:123
我做了下面的批处理,求高手帮忙看下,是哪边有问题,我执行后,在FTP服务器上并没有备份文件- @echo 开始检查备份%date% %time%>>"1.log"
-
- call:开始获取待检查的文件名
- call:开始备份文件至FTP
-
- @echo 结束检查备份%date% %time%>>"1.log"
- exit
-
- goto :eof
- :开始获取待检查的文件名
- (for /f "delims=" %%a in ('dir /a-d /b /o-d /s F:\backup\*.*') do @echo %%a&goto :eof)
-
- >"Backup_Processing.txt"
-
- goto :eof
-
- :开始备份文件至FTP
- CD /D D:\Backup_Processing
- set /p localfile=<Backup_Processing.txt
- >D:\Backup_Processing\Backup_FTP.ftp ECHO OPEN 192.168.2.50
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO backup
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO 123
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO BIN
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO CD Tools
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO PUT %localfile%
- >>D:\Backup_Processing\Backup_FTP.ftp ECHO BYE
- FTP -V -I -S:"D:\Backup_Processing\Backup_FTP.ftp"
- DEL D:\Backup_Processing\Backup_FTP.ftp /F /Q
- goto :eof
复制代码 执行后,目录下产生的Backup_FTP.ftp文件中内容是这样的:- OPEN 192.168.2.50
- backup
- 123
- BIN
- CD Tools
- PUT F:\backup\DMS_CVS.0.DB2.NODE0000.CATN0000.20120708213006.001
- BYE
复制代码 我手工在CMD窗口中,跑Backup_FTP.ftp是没有问题的,可以实现
PS:本地服务器和FTP服务器是windows环境。 |