Skip to content

Instantly share code, notes, and snippets.

@xupyprmv
Created March 4, 2014 06:28
Show Gist options
  • Save xupyprmv/9341324 to your computer and use it in GitHub Desktop.
Save xupyprmv/9341324 to your computer and use it in GitHub Desktop.
Remove all files in specified folder older than N minutes (N is a parameter (bash, checked on Ubuntu 12.04)
#!/bin/bash
if [ $# -eq 2 ]; then
find $2 -type f -mmin +$1 -delete
else
echo "Illegal arguments. Right syntax is: removeold.sh N FOLDERPATH"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment