Widnows定时压缩备份

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本程序将本地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!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值