Skip to content

Instantly share code, notes, and snippets.

View lazd's full-sized avatar

Larry Davis lazd

View GitHub Profile
#!/usr/bin/env bash
# Delete files older than the given number of days in the given directory
# Usage: rmold $DAYS $DIR
# Example: rmold 7 temp
function rmold() {
DAYS=$1
DIR=$2
# Find only files older than the specified date/time
echo "Deleting files in $DIR older than $DAYS days old"