Results 1 to 3 of 3
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 ...
- 10-28-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 2
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
- 10-30-2010 #2
You're getting the > prompt because you forgot to close the beginning ' in your CLI. Can also run find with the -exec option to find and delete at the same time.
or alternativelyCode:find . -type d -name 0* -mtime +5 -exec rm -rf {} \;
Code:find . -type d -name 0* -mtime +5 | xargs rm -rf
- 10-31-2010 #3
BusyBox is a single program that emulates all the basic Linux commands and utilities; it's just a way of fitting a working Linux shell into a tiny space. When you type "rm" on a system that has BusyBox installed, instead of the rm program running, BusyBox runs - and similarly for all the other commands. Therefore, if you enter erroneous syntax, the error message comes from BusyBox.
"I'm just a little old lady; don't try to dazzle me with jargon!"


Reply With Quote
