功能:打包文件列表中的文件,存为带日期标签的文件,每天定时备份一次,同时为避免备份量过大,只保留每月底和近一周的副本,最多共18个备份。
windows下 backup.cmd
rem @echo off
rem configure rar tool path
set rartool="C:/Program Files/WinRAR/rar.exe"
rem configure project name
set prjname="Project"
rem configure include list file name
set exclist=%prjname%_exclude.lst
rem configure exclued list file name
set inclist=%prjname%_include.lst
rem get date string
set date_str=%date:~0,4%%date:~5,2%%date:~8,2%
rem constructe target file name
set backup_filename=%prjname%_%date_str%.rar
rem back up file with file list
%rartool% a -x@%exclist% "%backup_filename%" @%inclist%
rem TODO 删除旧的备份
Linux下
本文介绍了一个自动备份脚本,用于在Windows和Linux环境下按计划备份指定文件列表中的文件,并使用WinRAR进行压缩。备份文件带有日期标签,且仅保留每月末和最近一周的备份副本,最多不超过18个。
704

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



