定时压缩备份文件(夹)并FTP上传至备份服务器(BAT)
rem 定时备份文件并FTP上传至备份服务器
rem 要备份的文件夹(多个文件夹用空格分开)
set bak_webFile=E:\sman\webfile E:\sman\datafile
rem 临时文件夹
set bak_tmpFile=C:\~SmanTemp\
rem 日志文件夹
set bak_logPath=C:\~bak_log\
rem 生成的rar 文件名
set bak_bakFile=YYYYMMDD(页面备份)
rem 当前日期(格式YYYYMMDD)
set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%
rem ftp信息
set bak_ftpServer=127.0.0.1 88
set bak_ftpUserName=test
set bak_ftpUserPass=123
set bak_timeStart=%time%
md %bak_tmpFile%
md %bak_logPath%
echo -------- 开始压缩 [%bak_timeStart%] >%bak_logPath%log-%bak_date%.txt
"C:\Program Files\WinRAR\Rar.exe" a -ag+%bak_bakFile% %bak_tmpFile% %bak_webFile%
echo -------- 压缩完成,开始上传 [%time%/%bak_timeStart%] >>%bak_logPath%log-%bak_date%.txt
rem 生成ftp命令文件
echo open %bak_ftpServer% >ftp.sman
echo %bak_ftpUserName%>>ftp.sman
echo %bak_ftpUserPass%>>ftp.sman
echo bin >>ftp.sman
echo mkdir %bak_date% >>ftp.sman
echo cd %bak_date% >>ftp.sman
echo mput %bak_tmpFile%\* >>ftp.sman
echo bye >>ftp.sman
FTP -s:ftp.sman -i >>%bak_logPath%log-%bak_date%.txt
del ftp.sman /q
rem Xcopy %bak_tmpFile%* C:\Temp /y
del %bak_tmpFile%*.* /q /s
rd %bak_tmpFile% /q
echo -------- 上传完成 [%time%/%bak_timeStart%] >>%bak_logPath%log-%bak_date%.txt
定时压缩备份文件(夹)并FTP上传至备份服务器批处理,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/feiger/p/3837948.html