#!/bin/bash # Remove old backups # javier.veron@nuthost.com DU=$(df -h | awk '/backup/ {print $5}' | cut -f 1 -d '%') if [ $DU -gt 80 ] ; then find /backup -maxdepth 1 -ctime +6 -type d -regextype posix-extended -regex "\/.*/[0-9]{4}-[0-9]{2}-[0-9]{2}$" -exec rm -rf {} \; fi