1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
@
echo
off
#配置变量
set
t=%
time
:~0,-3%
set
t=%t::=%
set
daytime=%
date
:~0,4%%
date
:~5,2%%
date
:~8,2%-%t: =0%
set
rar=
"C:\Program Files\WinRAR\Rar.exe"
set
webback_path=
"F:\web_backup"
set
rsync
=
"C:\cwRsync\bin"
#进入目录开始备份
echo
"开始备份站点%daytime%........."
>>%webback_path%\backweb.log 2>&1
if
exist E:\WEB (
cd
E:\WEB E:)
else
(
exit
1)
#分别打包文件
for
/f
%%i
in
(bak.txt)
do
%rar% a -k -r -s -m3 %webback_path%\%%i_%daytime%.rar %%i
#同步到远程服务器上
%
rsync
%\
rsync
-vzrtpg --progress
/cygdrive/f/web_backup/
rsync
:
//172
.16.0.128:873
/WEB_back
#删除15天以前的备份
forfiles
/p
%webback_path%
/s
/m
*.*
/d
-15
/c
"cmd /c echo deleting @file ... && del /f @path"
|
本文转自 80后小菜鸟 51CTO博客,原文链接:http://blog.51cto.com/zhangxinqi/1921147