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

Tim Conway conway at
Tue Aug 10 14:37:30 GMT 2004

You want everything in wex into wex on the remote.  Gotcha.
Let's take a simple case.
wex contains a b c d e.
"/usr/local/bin/rsync -rsh=/usr/bin/rsh -r --delete --perms --owner 
--group /mail/spool/imap/user/wex/* 
root at" on the commandline becomes 
"/usr/local/bin/rsync -rsh=/usr/bin/rsh -r --delete --perms --owner 
--group /mail/spool/imap/user/wex/a /mail/spool/imap/user/wex/b 
/mail/spool/imap/user/wex/c /mail/spool/imap/user/wex/d 
root at".  The parameter ending in 
"*" is replaced by as many entries as there are in the directory, which 
can be quite a loth, and is your problem.  rsync is perfectly happy to 
handle freaking enormous numbers of files, but it has to find out about 
Unless there's some valid reason why you want to avoid applying 
perms,owner,group to the wex directory itself, "/usr/local/bin/rsync 
-rsh=/usr/bin/rsh -r --delete --perms --owner --group 
root at" will work nicely, or 
perhaps "/usr/local/bin/rsync -rsh=/usr/bin/rsh -r --delete --perms 
--owner --group /mail/spool/imap/user/wex 
root at".  These will let rsync build 
the filelist itself, avoiding problems (and plain old inefficiencies) of 
argument passing.
Speaking of inefficiencies, unless you want to avoid maintaining symlinks 
devices (not likely to be there anyway) and times, you can improve 
readability by changing your commandline to "/usr/local/bin/rsync 
-rsh=/usr/bin/rsh -a --delete /mail/spool/imap/user/wex/. 
root at"  Letting it keep times 
synced lets it use them to optimize future syncs by not checksumming files 
that match in name/timestamp/size.  "-a" is a lot faster to type than 
"--owner --group --perms --times --links --recursive --devices"

Tim Conway
Unix System Administration
Contractor - IBM Global Services
conway 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".

BUT, if I try tris command it works: "/usr/local/bin/rsync 
-rsh=/usr/bin/rsh -r --delete --perms --owner --group 
/mail/spool/imap/user/* root at".

More information about the rsync mailing list