solution: Re: rsync takes way too long to perform this....

Martin Pool mbp at samba.org
Fri Nov 23 17:35:59 EST 2001


On 14 Nov 2001, Jason Helfman <jhelfman at bizrate.com> wrote:
> rsync -avnp remote::gif/ `find /home/www/html/ -maxdepth 1
> -name "*.[j,g][pg,if]*"` /tmp/

I can't see how this syntax will work.  The shell will expand this to:

  rsync -avnp remote::gif/ /home/www/html/foo.jpg /home/www/html/bar.gif (more filenames here) /tmp/

which I think from rsync's point of view means: copy all of
remote::gif/, plus a pile of local files, into /tmp/.  Is that really
what you want?

Secondly, when running from an rsync daemon (two-colon syntax) rsync
should never expand remote backtick substitutions, because we don't
want to allow weakly-authenticated remote users to run commands on the
server.

Incidentally, your shell syntax is strange.  (Not a flame, just a
point of information. :-) Your wildcard means: "anything containing a
dot then any character from the set (j, comma, or g), then any
character from the set (p, g, comma, i or f)."  If you wanted all
images then it might be better to say

 find /home/www/html -maxdepth 1 '(' -name '*.jpg' -o -name '*.gif' ')'

Note also that -n means "don't copy anything, just list filenames".

What is that it you actually want to achieve?  If you want all image
files and directories to come back to /tmp/remoteimages, then try

  rsync -avp remote::gif/ --include '*.jpg' --include '*.gif' \
  --include '*/' --exclude '*' /tmp/remoteimages/

If you just want a list of them:

  rsync -avp remote::gif/ --include '*.jpg' --include '*.gif' \
  --include '*/' --exclude '*' 

-- 
Martin 




More information about the rsync mailing list