[X-Unix] Trying to get rid of unwanted files

Stroller MacMonster at myrealbox.com
Thu May 13 14:12:23 PDT 2004


On May 13, 2004, at 3:26 pm, Mark Gibson wrote:

> At 07:17 -0700 13/5/04, Larry Helms wrote:
>> [cron schedule date/time stuff] cd /var/spool/cups; rm *; {other 
>> commands
>> you want to perform}
>
> Yes,
>
> But wont that remove /tmp as well?
> /tmp is in /cups (i.e. /var/spool/cups/tmp). I need something that 
> removes the files but leaves the structure intact.

You want to use `find, in conjunction with the "-prune" primary.
Something like:
   find /var/spool/cups -type f -prune /var/spool/cups/tmp -exec rm -f 
\{} \;

DISCLAIMER: this is untested, and I haven't spent much time thinking 
about it. I find `find` quite non-intuitive, but I think you'll find 
`find` worth learning. If you play about a bit with it, based on the 
above command, then I think you'll get what you want.

Start out with:
   find /var/spool/cups -type f -prune /var/spool/cups/tmp -print
which will just print the files `find` finds.

Stroller.



More information about the X-Unix mailing list