[olug] Unix Tip: DEALING WITH TOO MANY FILES

Quinn Coldiron qcoldir at nmhs.org
Fri Mar 21 19:56:02 UTC 2003


One of the many problems I have with a certain package I support on AIX
is that they dump and ton and a half of files into a single directory,
and I can't change that.  I need to clean that out periodically and rm *
gives me the same error.  Recursively removing the directory and then
rebuilding the directory is not an option, so I made a shell script to
do this:

#!/bin/sh
for i in `ls -1`
do
rm $i
done

Does somebody know of a better way?

Quinn



On Fri, 2003-03-21 at 13:24, Unix Guru Universe wrote:
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> 			      UNIX GURU UNIVERSE 
> 			         UNIX HOT TIP
> 
> 			Unix Tip 1906 - March 21, 2003
> 
> 		    http://www.ugu.com/sui/ugu/show?tip.today
> 
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> 
> DEALING WITH TOO MANY FILES
> 
> In case there are too many files in a 
> particular directory  and you try doing 
> 
> $ grep "ABC" *
> 
> And it fails saying 
> ksh: /usr/bin/find: 0403-027 The parameter list is too long.
> 
> what would you do?
> 
> Well you can do the following:
> 
> $ls |xargs grep "ABC"
> 
> This tip generously supported by: puneeta at delhi.tcs.co.in
> 
> 
> --------------------------------------------------------------------------
> To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
> To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
> To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
> 
> ==========================================================================
> DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
> NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX 
> GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT 
> ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
> 
> Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
> ==========================================================================
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
-- 

-----------------------------
Quinn P. Coldiron
Cerner Technical Coordinator
Nebraska Methodist Hospital
402-354-1619
qcoldir at nmhs.org




More information about the OLUG mailing list