本程序将本地E:\Repositories整个目录备份到\\192.168.13.159\public\xzs\svn_repository上保存,备份文件名按天命名,这样可以保留一个月。
然后设置Windows计划任务即可。
脚本如下
@echo off
echo set the directory which is need backup......
set src_bak_dir=E:\Repositories
echo set the directory which is for saving the backup
set save_bak_dir=\\192.168.13.159\public\xzs\svn_repository
echo initialize the rar program
cd \
C:
cd C:\Program Files\WinRAR
set yes=ok
echo rar program is at C:\Program Files\WinRAR\WinRAR.exe
echo set the backup file name with weekday, only save one week
set suffix=%date%
set suffix=%suffix:-=%
set suffix=%suffix:/=%
set suffix=%suffix:~6,2%
set backup_file_name=naiveloafer_backup_%suffix%
echo delete the old backup file which is the same name
if exist %save_bak_dir%\%backup_file_name%.rar del %save_bak_dir%\%backup_file_name%.rar
echo start...
rar a -r -ed -esh %save_bak_dir%\%backup_file_name%.rar %src_bak_dir%\*.*
echo backup is done!