Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?
share|improve this question
2  
It is by chance present a local folder /var/www/phrogz.net/public/public ? –  enzotib Dec 4 '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 4 '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 4 '11 at 21:06

1 Answer 1

up vote 6 down vote accepted

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 :.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.