Re: [Nolug] find folder delete contents

From: Brett D. Estrade <estrabd_at_mailcan.com>
Date: Tue, 13 Dec 2005 12:08:23 -0600
Message-Id: <1134497303.4751.249704316@webmail.messagingengine.com>

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
___________________
Nolug mailing list
nolug@nolug.org
Received on 12/13/05

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