Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 /var/www/

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/*
-rw-r----- 1 phrogz www-admin 6404 2011-02-26 21:49 /var/www/

phrogz@planar:~$ ssh 'ls -Fla /var/www/*'
-rw-r--r-- 1 phrogz phrogz 1951 2011-12-04 09:07 /var/www/
-rw-r--r-- 1 phrogz phrogz 6404 2011-02-26 21:49 /var/www/

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
It is by chance present a local folder /var/www/ ? – 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
Remove the final "public" from your script, so it becomes: rsync -rztpl --stats --rsh=/usr/bin/ssh /var/www/ - should do it. – Caesium Dec 4 '11 at 21:06
up vote 9 down vote accepted

You could simplify your command to

rsync -az --stats /var/www/

or alternatively

rsync -az --stats /var/www/

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


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.