Skip to content

Instantly share code, notes, and snippets.

@mikedamage
Created April 27, 2015 18:55
Show Gist options
  • Save mikedamage/0bfa6934545a7918c0fa to your computer and use it in GitHub Desktop.
Save mikedamage/0bfa6934545a7918c0fa to your computer and use it in GitHub Desktop.
Quick and dirty time-based file removal
#!/usr/bin/env zsh
setopt NULL_GLOB EXTENDED_GLOB
# Files older than this will be deleted
KEEP_DAYS=30
files=($PWD/*(.Nmd+$KEEP_DAYS))
for f in $files; do
rm -vf "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment