You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
431 B
Bash

time=$(date "+%Y-%m-%d_%H:%M:%S")
zipfilename="Docker挂载目录备份_"$time".7z"
storagepath="压缩文件存储目录"
zippassword="压缩密码"
zippath=${storagepath}/${zipfilename}
filepath="需要备份的文件夹目录"
7z a -p${zippassword} -r $zippath $filepath > /dev/null 2>&1
deleteBakDay=1
find $storagepath -name "Docker挂载目录备份_*.7z" -type f -mtime +${deleteBakDay} -exec rm -rf {} \; > /dev/null 2>&1