My shell script:
#!/bin/bash
if [ $# -lt 2 ]
then
echo "$0 : Not enough argument supplied. 2 Arguments needed."
echo "Argument 1: -d for debug (lists files it will remove) or -e for execution."
echo "Followed by some path to remove files from. (path of where to look) "
exit 1
fi
if test $1 == '-d'
then
find $2 -mmin +60 -type f -exec ls -l {} \;
elif test $1 == '-e'
then
find $2 -mmin +60 -type f -exec rm -rf {} \;
fi
Basically this will find files in a given directory provided as second argument and either list (-d for argument 1) or remove (-e for argument 1) files modified >60 minutes ago.
How can I rework this to also remove folders ?