码迷,mamicode.com
首页 > 其他好文 > 详细

Widnows批处理异地备份数据

时间:2015-12-05 19:31:39      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

@echo off
@title Mysql+fileBckup
set files=D:\backup\%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 Files\WINRAR"
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
@echo 开始backup Mysql
md "D:\backup\%Ymd%.mysq l"
"D:\phpStudy\MySQL\bin\mysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 discuz > "D:\backup\%Ymd%.mysql\discuz.sql"
"D:\phpStudy\MySQL\bin\mysqldump.exe" --opt -Q -uroot -p123456 --default-character-set=utf8 dede > "D:\backup\%Ymd%.mysql\dede.sql"
"D:\phpStudy\MySQL\bin\mysqldump.exe" --opt -Q -u root -p123456 --default-character-set=utf8 weixin > "D:\backup\%Ymd%.mysql\weixin.sql"

@echo 开始压缩文件
C:
cd C:\Program Files\WINRAR
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 Settings\Administrator\桌面
echo %date% 备份成功
pause

 

 

 

 

C:\ftp.txt 内容

ftpuser
123456
put D:\backup\%date:~0,10%.rar
bye

Widnows批处理异地备份数据

标签:

原文地址:http://www.cnblogs.com/yangxiaofei/p/5022057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!