[LUAU] How do you delete over 500,000 files in a directory
    Clifton Royston 
    cliftonr at iandicomputing.com
       
    Thu Nov  3 11:37:43 PST 2005
    
    
  
On Thu, Nov 03, 2005 at 09:23:54AM -1000, 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'
...
> All the files start with mgetty. I would like to prserve the other files in
> the directory and the directories below /var/log
  ls | grep '^mgetty' | perl -nle 'unlink;'
  find . -name 'mgetty*' -maxdepth 1 -print | perl -nle 'unlink;'
  find . -name 'mgetty*' -maxdepth 1 -print | xargs rm
  ... and numerous variations you can probably think of now that you've
got the idea.  Just avoid anything which requires the shell to do
globbing and you'll be fine.
  -- Clifton
-- 
    Clifton Royston  --  cliftonr at iandicomputing.com / cliftonr at lava.net
       President  - I and I Computing * http://www.iandicomputing.com/
 Custom programming, network design, systems and network consulting services
    
    
More information about the LUAU
mailing list