[LUAU] How do you delete over 500,000 files in a directory
    Jon Reynolds 
    jonr at destar.net
       
    Thu Nov  3 13:48:15 PST 2005
    
    
  
Matt Darnell wrote:
> Aloha,
> 
> We have a box with over 500,000 files in a direcotry. If I try 'rm m*' I get
> an error, something like 'too many arguments'
> 
> I think someone else in this situation had a method of switching to another
> shell, bash is default.
> 
> All the files start with mgetty. I would like to prserve the other files in
> the directory and the directories below /var/log
> 
> Anyone have any ideas?
> 
> Aloha,
> Matt
> _______________________________________________
> LUAU at lists.hosef.org mailing list
> http://lists.hosef.org/cgi-bin/mailman/listinfo/luau
> 
> 
 From the 'find' man page:
EXAMPLES
        find /tmp -name core -type f -print | xargs /bin/rm -f
        Find  files  named core in or below the directory /tmp and 
delete them.
        Note that this will work incorrectly if there are  any 
filenames  con-
        taining newlines, single or double quotes, or spaces.
        find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
        Find  files  named core in or below the directory /tmp and 
delete them,
        processing filenames in such a way that file or  directory 
names  con-
        taining  single or double quotes, spaces or newlines are 
correctly han-
        dled.  The -name test comes before the -type test  in  order  to 
  avoid
        having to call stat(2) on every file.
It is also in the xargs man page.
Jon
    
    
More information about the LUAU
mailing list