[lkml]   [2002]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: File Limit in Kernel?
On 12 Nov 2002 10:38:55 -0500
Adam Voigt <> wrote:

> I have a directory with 39,000 files in it, and I'm trying to use the cp
> command to copy them into another directory, and neither the cp or the
> mv command will work, they both same "argument list too long" when I
> use: cp -f * /usr/local/www/images
> Is this a kernel limitation?

Yes, but you can get around it in userspace. See

(Short answer is this from include/linux/binfmts.h.:
* MAX_ARG_PAGES defines the number of pages allocated for arguments
* and envelope for the new program. 32 should suffice, this gives
* a maximum env+arg of 128kB w/4KB pages!
#define MAX_ARG_PAGES 32

I'm assuming your arch has 4kb pages, so the 'problem' is that you're
passing more than 128kb of cmdline arguments.)

> If yes, how can I get around it?

The article has a bunch of ways. You don't really need to change
the kernel though ... if you don't mind generating 39000 new processes
one after the other, I'd do something like 'for FILE in * ; do mv $FILE
/usr/local/www/images ; done'. Probably slower than calling mv once due
to process overhead done 39000 times, but it *works*, and it's simple.
(If you use a csh instead of something bash-like, change that to fit.)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:30    [W:0.040 / U:9.544 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site