Re: [Nolug] find folder delete contents

From: John Kosta <johnkosta_at_earthlink.net>
Date: Tue, 13 Dec 2005 14:16:47 -0600
Message-ID: <439F2C2F.40304@earthlink.net>

Brett,

thanks, I think that is going to work. I am backing up the partition in
question now, just in case.

But, if I change the -exec portion to:

-exec ls {} \;

for testing, it works perfectly, and I get a listing of the contents of
those directories.

--John

Brett D. Estrade wrote:
> How about:
>
> find /usr/home -type d -name "*[Cc]ache*" -print -exec "rm -rf {}/*.*"
> \;
>
> USE AT YOUR OWN RISK - TEST IN A MEANINGLESS ENVIRONMENT FIRST....also,
> you may want to pipe the results of "find" into xargs rather than using
> its simple "-exec" flag. I am not that familiar with xargs, so I won't
> try to tell you how to use it.
>
> Also note, the above will not do exactly what you want if you have cache
> dirs inside of cache dirs...again, tailor to your own needs and test
> before executing this bc there is no turning back.
>
> Brett
>
> On Tue, 13 Dec 2005 11:35:33 -0600, "John Kosta"
> <johnkosta@earthlink.net> said:
>> Can someone help me out here?
>>
>> I am trying to find every folder named "cache" on a partition and delete
>> any files within.
>>
>> find -iregex '.*cache*'
>>
>> works, to get a listing, say:
>>
>> ./username/profile/Application
>> Data/Mozilla/Firefox/Profiles/rjx12q2y.default/Cache
>>
>> I can't figure out how to turn around and delete the stuff in that
>> folder (part of the problem is the " " in M$'s "Application Data")
>>
>> I have 177 users or so I want to do this for on a fairly regular basis.
>> Each user may or may not have more than one type of "cache"
>> directory (Citrix, Firefox, etc.)
>>
>> I can keep working on my shell script, but I though one of you might
>> have a solution.
>>
>> Thanks,
>>
>> John Kosta
>> ___________________

___________________
Nolug mailing list
nolug@nolug.org
Received on 12/13/05

This archive was generated by hypermail 2.2.0 : 12/19/08 EST