#!/bin/bash
# 定义图片的目录路径
image_directory="/www/wwwroot/resources/images/"
# 获取当前日期
current_date=$(date +%Y-%m-%d)
# 计算30天前的日期
ten_days_ago=$(date -d "30 days ago" +%Y/%m/%d)
# 使用find命令删除30天前创建的文件
find "$image_directory" -type f -mtime +30 -exec rm -f {} \;
shell脚本定时清理文件
于 2024-03-04 13:08:34 首次发布