Print

Print


On Thu Aug 16 11:14:56 EDT 2007, "ODEN,MARK THOMAS" 
<[log in to unmask]> wrote:

> On Tue Aug 14 13:53:33 EDT 2007, Shawn McMahon <[log in to unmask]> 
> wrote:
> 
>> On Tue, 2007-08-14 at 12:47 -0400, ODEN,MARK THOMAS wrote:
>>> 
>>> 
>>> > find /ftp/traces -cmin +1440 -type f -exec rm -rf {} \;
>>> > > Thanks Shawn.  Can you help me understand what "{} \;" does 
>>> (how to interpret it)?
>> 
>> {} substitutes the current file found; basically inserts what 
>> "-print"
>> would have output.  The ";" says to do one invocation of the 
>> command per
>> file; a "+" would be used to do something different that I've 
>> never once
>> done and thus can't be sure I understand.  The "\" is necessary 
>> or the
>> shell interprets the ";" as something else.
>> 
>> See the man page for more detail.  Hint: to search a man page 
>> for "{}"
>> you'd need to do "/\{\}"
>> 
>> 
> Thanks again Shawn.
> 
> So a problem I should have anticipated; the new find command only 
> finds files (as I requested...) but it does not take care of the 
> folders that were created by the log backup.  Any way to take 
> care of these w/o deleting the root folder as was the problem 
> before?
> 
> ~Mark Oden
> 
> 

So this is what I came up with, let me know if there is a better 
method.  I will put these two lines:

find $CCM_LOGS_DIR/$IP/ -mmin +1440 -type f -print -exec rm -rf {} 
\;
find $CCM_LOGS_DIR/$IP/`date +%Y`* -mmin +1440 -type d -print 
-exec rm -rf {} \;

Where the variables are defined in the script and `date +%Y` 
evaluates to 2007 which all first branch subfolders in $IP/ will 
start with.

Sound good?

~Mark Oden