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

Tim Conway conway at us.ibm.com
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 192.168.250.68:/mail/spool/imap/user/wex" 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 
/mail/spool/imap/user/wex/e 
root at 192.168.250.68:/mail/spool/imap/user/wex".  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 
them.
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 
/mail/spool/imap/user/wex/. 
root at 192.168.250.68:/mail/spool/imap/user/wex/." 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 192.168.250.68:/mail/spool/imap/user".  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 192.168.250.68:/mail/spool/imap/user/wex/."  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
desk:3032734776
conway at us.ibm.com



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 192.168.250.68:/mail/spool/imap/user/wex".

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 192.168.250.68:/mail/spool/imap/user/wex".




More information about the rsync mailing list