[MLIST] Re: [olug] Unix Tip: DEALING WITH TOO MANY FILES

David Walker linux_user at grax.com
Fri Mar 21 20:28:54 UTC 2003


find .-type f  -maxdepth 1 -exec rm {} \;
find "files only" "this directory only" "rm filename"

still has problems with spaces in the file name though

On Friday 21 March 2003 01:56 pm, Quinn Coldiron wrote:
> 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



More information about the OLUG mailing list