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.
7 lines
376 B
Bash
7 lines
376 B
Bash
time=$(date "+%Y-%m-%d_%H:%M:%S")
|
|
zipfilename="存储压缩包名字_"$time".tar.gz"
|
|
storagepath="压缩包存放目录"
|
|
zippath="压缩的目录文件等"
|
|
tar -zcvf ${storagepath}/${zipfilename} -C $zippath .
|
|
deleteBakDay=8 # 保留多少天的记录
|
|
find $storagepath -name "存储压缩包名字_*.tar.gz" -type f -mtime +${deleteBakDay} -exec rm -rf {} \; > /dev/null 2>&1 |