12

I'm trying to synchronize a large directory of files from my server to a local box. (Both are running Ubuntu.) I have a command that looks like it works, but certain files are not copied:

phrogz@planar:~$ cat ./sync-phrogz-public 
rsync -rztpl --stats --rsh=/usr/bin/ssh 69.46.18.236:/var/www/phrogz.net/public /var/www/phrogz.net/public

phrogz@planar:~$ ./sync-phrogz-public 
Number of files: 10320
Number of files transferred: 0
Total file size: 4221864770 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 197778
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 388
Total bytes received: 199213

sent 388 bytes  received 199213 bytes  79840.40 bytes/sec
total size is 4221864770  speedup is 21151.52

phrogz@planar:~$ la /var/www/phrogz.net/public/svg/convert*
-rw-r----- 1 phrogz www-admin 6404 2011-02-26 21:49 /var/www/phrogz.net/public/svg/convert_path_to_polygon.xhtml

phrogz@planar:~$ ssh 69.46.18.236 'ls -Fla /var/www/phrogz.net/public/svg/convert*'
-rw-r--r-- 1 phrogz phrogz 1951 2011-12-04 09:07 /var/www/phrogz.net/public/svg/convert_matrix.html
-rw-r--r-- 1 phrogz phrogz 6404 2011-02-26 21:49 /var/www/phrogz.net/public/svg/convert_path_to_polygon.xhtml

As you can see, the file convert_matrix.html did not get copied.

  1. What is the command doing, if not actually copying files?
  2. How do I get it to actually copy the files?
Phrogz
  • 1,646
  • 3
    It is by chance present a local folder /var/www/phrogz.net/public/public ? – enzotib Dec 04 '11 at 18:11
  • Whoa, yes, there is! Post that as an answer, and tell me how to change the command to not create public as a subfolder, and you've got yourself 25 rep :) – Phrogz Dec 04 '11 at 21:00
  • 1
    Remove the final "public" from your script, so it becomes: rsync -rztpl --stats --rsh=/usr/bin/ssh 69.46.18.236:/var/www/phrogz.net/public /var/www/phrogz.net - should do it. – Caesium Dec 04 '11 at 21:06

1 Answers1

20

You could simplify your command to

rsync -az --stats 69.46.18.236:/var/www/phrogz.net/public /var/www/phrogz.net/

or alternatively

rsync -az --stats 69.46.18.236:/var/www/phrogz.net/public/ /var/www/phrogz.net/public

As you see, rsync interprets differently a source with or without a trailing /.

Also, -a is equivalent to -rtplogD, (with respect to your command line, the -a also adds -o, preserve owner, -g, preserve group and -D, preserve devices and special files).

Finally, the --rsh option is redundant when the source or the destination is in the form host:/path, with a single :.

enzotib
  • 93,831