#!/bin/bash
# 设置备份目录
backup_dir="/path/to/backup/dir"
# 设置要备份的文件或目录
files_to_backup="/path/to/files /path/to/dir"
# 创建一个日期时间戳
timestamp=$(date +%F_%T)
# 备份文件
tar -czvf "${backup_dir}/backup_${timestamp}.tar.gz" ${files_to_backup}
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8