Delete files older than thirty days

Bash

Prunes an archive directory without touching anything recent. Run it with -print first to see what would go.

# Dry run first:
find /var/backups -type f -mtime +30 -print

# Then delete:
find /var/backups -type f -mtime +30 -delete

More in Shell

Random picks