bash: /usr/local/bin/rsync: Argument list too long

Jan-Benedict Glaw jbglaw at
Tue Aug 10 12:36:02 GMT 2004

On Tue, 2004-08-10 14:41:54 +0300, victor <victor at>
wrote in message <4118B482.90900 at>:
> I get this error when I try to copy a directory with a lot of files: 
> "bash: /usr/local/bin/rsync: Argument list too long"
> The exact command is: "/usr/local/bin/rsync -rsh=/usr/bin/rsh -r 
> --delete --perms --owner --group /mail/spool/imap/user/wex/* 
> root at".

The "*" you supply is expanded by the shell to a lot of filenames. Your
shell uses some internal buffer (which may grow to several megabytes),
but upon exec*(), the kernel cannot copy all the list to the (child's)
argv[] buffer, thus rejecting to exec() at all.

So this isn't actually a limitation of your shell, but of your operating
system. IIRC Linux will grant you some 128 KB on systems using 4KB pages
(that is, the famous PeeCee).

You've got several ways to work around that:

	- Try to split your single rsync call into severals:

		rsync a*
		rsync b*
		rsync c*

	- Hack your operating system's kernel to allow a larger buffer
	  for argv[]. (For Linux, you'll need to edit
	  ./include/linux/binfmts.h; change MAX_ARG_PAGES to whatever
	  you like better)

	- Try to use xargs, but that may be tricky...


Jan-Benedict Glaw       jbglaw at    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url :

More information about the rsync mailing list