Need a little help with some find and delete
Hey- so we have this fax server that is running a linux kernel and not an actual dist. from what I understand. Here is my problem:
I need to be able to script something to log into the box, run a find similar to the following:
find . -type d -name "0*" -mtime +5 |wc -l
this will list the files that are more than 5 days old? Is this right? If so, great. Now I would like to delete them:
being the newb I am, I figured I would try this one:
rm -rf `find . -type d -name "0*" -mtime +5
?
I have leanrted how to find and delete using:
ls -l |grep "^d.*Sep 13" |xargs rm -rf to delete every file from Sep 13. Works ok I guess.
What I want to really do is set this up in chrontab to delete the specific files that are older than 5 days and run this script every 5 days.
There is also something called busybox that is also giving me problems- no idea what that is.
# rm -rf find . -type d -name "0*" -mtime +5
rm: invalid option -- t
BusyBox v1.00 (2010.06.21-20:43+0000) multi-call binary
Usage: rm [OPTION]... FILE...
# rm -rf `find . -type d -name "0*" -mtime +5
>
but I get the > prompt. What does this mean? how do I deal with it?
If anyone can just help me that we would be great!
thanks
b