@echo off
@title Mysql+fileBckup
set files=D:ackup\%date:~0,10%.rar
set userdb="root"
set pwddb="123456"
set filepath="D:wwwroot"
set ftpfile="C:ftp.txt"
set ftpname=ftpuser
set ftppwd=ftpuser
set ftpfiles="%date:~0,10%.rar "
set ftpdomian="42.51.153.157"
set rarpath="C:Program FilesWINRAR"
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
@echo 开始backup Mysql
md "D:ackup\%Ymd%.mysq l"
"D:phpStudyMySQLinmysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 discuz > "D:ackup\%Ymd%.mysqldiscuz.sql"
"D:phpStudyMySQLinmysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 dede > "D:ackup\%Ymd%.mysqldede.sql"
"D:phpStudyMySQLinmysqldump.exe" --opt -Q -u root -p123456 --default-character-set=utf8 weixin > "D:ackup\%Ymd%.mysqlweixin.sql"
@echo 开始压缩文件
C:
cd C:Program FilesWINRAR
RAR.EXE a -r -y %files% %Ymd% %filespath% D:wwwroot
@echo 写入文件ftp
@echo %ftpname%>%ftpfile%
@echo %ftppwd%>>%ftpfile%
@echo put %files% %ftpfiles%>>%ftpfile%
@echo bye>>%ftpfile%
@echo 上传%files%.rar文件
ftp -s:%ftpfile% 42.51.153.157
cd C:Documents and SettingsAdministrator桌面
echo %date% 备份成功
pause
C:ftp.txt 内容
ftpuser
123456
put D:ackup\%date:~0,10%.rar
bye