MAX_ARG_PAGES

Stuart Lamble stu at gateway10.homeip.net
Mon Jan 3 19:54:16 UTC 2005


 

> -----Original Message-----
> From: fedora-list-bounces at redhat.com 
> [mailto:fedora-list-bounces at redhat.com] On Behalf Of john bray
> Sent: Monday, January 03, 2005 8:16 PM
> To: fedora-list
> Subject: RE: MAX_ARG_PAGES
> 
> On Mon, 2005-01-03 at 17:59 +0200, Stuart Lamble wrote:
> > Hi Russell
> > 
> > I have tried that, but I now get bash: xarg: Argument list too long.
> > 
> > I am actually taking a directory of some 4000 image files, 
> all about 
> > 11kb in size and using another program, writing them to an 
> *.avi file.
> > I then delete all the separate image files, where rm also complains 
> > with the same error.
> > 
> > Any other sugestions?
> > 
> > Where would be the best place to ask kernel questions?
> > 
> >  
> > 
> > > -----Original Message-----
> > > From: fedora-list-bounces at redhat.com 
> > > [mailto:fedora-list-bounces at redhat.com] On Behalf Of 
> Russell Kaiser
> > > Sent: Monday, January 03, 2005 12:11 PM
> > > To: For users of Fedora Core releases
> > > Subject: Re: MAX_ARG_PAGES
> > > 
> > > I have hit this problem before when doing "rm *" in a 
> directory with 
> > > lots and lots of files.  The way to get around this problem when 
> > > deleting a large number of files like that is to use the xargs 
> > > command with rm.  Here are a few examples of this.  Google xargs 
> > > with rm and you will see a few others:
> > > 
> > > http://freebooks.by.ru/view/ShellProgIn24h/31480122.htm
> > > 
> > > http://www.linuxjournal.com/article/6060
> > > 
> > > This doesn't address what you are trying to do in the 
> kernel, but is 
> > > one solution to your argument list too long issue.
> > > 
> > > --
> > > Russell Kaiser
> > > Russell.Kaiser at gmail.com
> > > 
> > > --
> > > fedora-list mailing list
> > > fedora-list at redhat.com
> > > To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> > > 
> > 
> > 
> russell - xargs is exactly what you want, i think.  but, you 
> may not be using it quite right.
> 
> in the directory where you want to delete the files, try this:
> ls *.avi | xargs rm

Yes, this syntax works beautifully, thanks.
> 
> ls will put out a list of the avi files on its standard out, 
> which will get sucked in by xargs.  xargs will then fill up a 
> command line buffer with those files and run rm on them.  and 
> repeat the process until there are no files left in it's 
> standard input to give to rm.
> 
> thus rm will be run the minimum number of times necessary, 
> with all but the last command line buffer full.
> 
> john
> 
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> 




More information about the users mailing list