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

victor victor at
Tue Aug 10 13:17:59 GMT 2004

Thank you.
I will try the first sugestion.

However, can you explain me why this command works?
/usr/local/bin/rsync -r --delete --perms --owner --group 
/mail/spool/imap/user root at
In /mail/spool/imap/user I have a lot of subdirectories with >1000 files.

What I mean is that rsync can make sutch a transfer(no mather the 
kernel), but for some reason he does not.

Jan-Benedict Glaw wrote:

> 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...
> MfG, JBG

More information about the rsync mailing list