本程序将本地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!
本文介绍了一段使用WinRAR脚本自动备份本地目录,并将其上传至远程服务器的过程,确保数据安全与远程存取。脚本通过设置备份文件名随日期变化,实现一个月内每天的数据备份。
2706

被折叠的 条评论
为什么被折叠?



