Bash-Skript: Backupfiles löschen, die älter als 7 Tage oder 0 Byte groß sind
#/usr/bin/env bash DAYS=7 # relative or absolute DIRECTORY="/backups" targetTimestamp=$(($(date +"%s")-(60*60*24*${DAYS}))) targetDate=`date --date=@${targetTimestamp} +"%Y-%m-%d"` find "${DIRECTORY}" -size 0 \ -or -not -newermt "${targetDate}" \ -exec rm {} \;
Sorry, the comment form is closed at this time.