@echo off
color 0f
title 定時(shí)備份文件并FTP上傳至備份服務(wù)器
rem 要備份的文件夾
echo:
set /p bak_webFile= 請將要上傳的文件(夾)拖到此處=
rem 當(dāng)前日期(格式Y(jié)YYYMMDD)
set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%
rem ftp信息
set bak_ftpServer=202.96.189.52
set bak_ftpUserName=Wingl83
set bak_ftpUserPass=l7l2O6OO
echo:
echo:
echo: 開始上傳
rem 生成ftp命令文件
echo open %bak_ftpServer% >ftp.up
echo %bak_ftpUserName%>>ftp.up
echo %bak_ftpUserPass%>>ftp.up
echo bin >>ftp.up
echo mput %bak_webFile%\* >>ftp.up
echo bye >>ftp.up
FTP -s:ftp.up -i >>%bak_logPath%log-%bak_date%.txt
del ftp.up /q
del log-%bak_date%.txt /q
echo:
echo:
echo: 上傳完成
rem 定時(shí)備份文件并FTP上傳至備份服務(wù)器
rem 要備份的文件夾
set bak_webFile=F:\備份\
rem 臨時(shí)文件夾
set bak_tmpFile=C:\~UpTemp\
rem 日志文件夾
set bak_logPath=C:\~bak_log\
rem 生成的rar 文件名
set bak_bakFile=YYYYMMDD(頁面?zhèn)浞?
rem 當(dāng)前日期(格式Y(jié)YYYMMDD)
set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%
rem ftp信息
set bak_ftpServer=202.96.189.52
set bak_ftpUserName=Wingl83
set bak_ftpUserPass=l7l2O6OO
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.up
echo %bak_ftpUserName%>>ftp.up
echo %bak_ftpUserPass%>>ftp.up
echo bin >>ftp.up
echo mkdir %bak_date% >>ftp.up
echo cd %bak_date% >>ftp.up
echo mput %bak_tmpFile%\* >>ftp.up
echo bye >>ftp.up
FTP -s:ftp.up -i >>%bak_logPath%log-%bak_date%.txt
del ftp.up /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