[comp.sys.next] Clearing out old .NeXTtrash files as System Administrator

giant@lindy.Stanford.EDU (Buc Richards) (04/10/90)

The .NeXTtrash directory never gets emptied unless done so manually.
As weekly routine I would like to clean out all the .NeXTtrash
directories of files are more than a week old.  When I give the find
command the option

	-name .NeXTtrash/*.* 

it complains for I believe that -name can only take the name of a file
and not directory information.

Does someone have a good way of cleaning .NeXTtrash directories automatically?

Thanks.

        Buc Richards                              @ @
        Supercomputer Support Staff                 >
        Stanford University                        -

CMH117@psuvm.psu.edu (Charles Hannum) (04/11/90)

Hm.  There are several ways you could do this.  The one that immediately
comes to mind is:  (Make sure the single quotes are *back*quotes!!)

   foreach d (`find / -name ".NeXTtrash" -type d -print`)
      rm -r $d/*
   end

(Note:  You'll want to redirect stderr when you do this!!)


Anyway, the biggest problem with yours is that you need quotes around
".NeXTtrash/*.*", otherwise the shell will try to expand it.  I doubt
it would work anyway, though I haven't tried it.

BTW:  Why "*.*"?  Sounds like MS-LOSS hangover to me.  ;-)


Virtually,
- Charles Martin Hannum II       "Klein bottle for sale ... inquire within."
    (That's Charles to you!)     "To life immortal!"
  cmh117@psuvm.{bitnet,psu.edu}  "No noozzzz izzz netzzzsnoozzzzz..."
  c9h@psuecl.{bitnet,psu.edu}    "Mem'ry, all alone in the moonlight ..."