#!/bin/sh test -n "$NO_DELETEBIGFILES" && exit 0 # disabled cleanup_big_files(){ local DIR=$1 local MAX_DAYS=$2 local MAX_MB=$3 test -n "$MAX_DAYS" && test -n "$MAX_MB" && { find "$DIR" -type f -mtime +"$MAX_DAYS" -size +$(( $MAX_MB * 1024 ))k | while read file; do echo "deleting: $file" rm "$file" done } } # delete files older than 5 days and >5mb (5mb in 2025, 6mb in 2026 e.g.) maxMB=$(( $(date +%Y) - 2020 )) cleanup_big_files /mnt/models 5 $maxMB