for FILE in `find /home/evilsquid/logs -maxdepth 1 -mtime -1 -name *.log`
do
echo $FILE
rm $FILE
done
This is a useful tidbit if you need to do some log file monitoring....
do
echo $FILE
rm $FILE
done
This is a useful tidbit if you need to do some log file monitoring....
2 comments:
Actually you don't need to script this...
You can use the -exec option (you may also want to specify that you want only files)
find /home/evilsquid/logs -type f -maxdepth 1 -mtime -1 -name *.log -exec rm {} \;
Actualy -maxdepth option doesnt work on Unix.
Those are gnu find options, the find from Unix (lets say for instance AIX, Solaris) dont have that many options.
And although the are available on all the linux flavors you should not depend on those options to make your scripts more portable.
Post a Comment