我的外壳脚本:
#!/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
基本上,这将在作为第二个参数提供的给定目录中找到文件,并列出(-d 表示参数 1)或删除(-e 表示参数 1)>60 分钟前修改的文件。
我怎样才能重做这个也删除文件夹?