@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后小菜鸟” 博客,谢绝转载!
原文地址:http://zhangxinqi.blog.51cto.com/9668428/1921147