rsync -rave "ssh -i ~/Desktop/mypemfile.pem" /users/myusername/dev/myproject/wp-content/uploads/* ubuntu@myinstance(changed name).compute.amazonaws.com:/var/www/html/production/wp-content/uploads --omit-dir-times

/var/www/html/production/wp-content/uploads/2018/02 has 50 extra files that are not present in /users/myusername/dev/myproject/wp-content/uploads/2018/02

Why aren't they copied over to /Users/.... ?

rsync outputs this:

building file list ... done

sent 678984 bytes  received 20 bytes  452669.33 bytes/sec
total size is 3691754591  speedup is 5437.01

but does nothing.

  • 1
    looks to me like you're syncing from /users/... to /var/www, without the --delete flag, which means it's OK that the destination has more files. Is that the intention with your command? – Jeff Schaller Feb 14 '18 at 21:09
  • I would like to make sure all files existing in my EC2 instance below ../wp-content/uploads/*.* (recursively) find . their way into my local machine /users/....... /wp-content/uploads - I know I can scp, but scp doesn't do incremental..... I need an incremental copy really. – JasonGenX Feb 14 '18 at 21:17
  • 1
    You have the arguments backwards. It's rsync source destination – Barmar Feb 14 '18 at 22:19
  • You mention /Users/ in your text but your command uses /users/. UNIX/LInux-based systems are case sensitive and this difference might be important. – roaima Feb 14 '18 at 23:31

The rsync command uses the same structure as cp and mv: the source leads the destination on the command line:

rsync  --flags...  /source/path  /destination/path

So in your instance the reason nothing is being copied to /users/ (note, not /Users/ as in your question text) is because you are copying from /users to the remote AWS target.

If you wanted to copy from AWS to your local filesystem you should be using a command like this (split over three lines; note that the trailing \ indicates a continuation to the next line):

rsync -avO -e "ssh -i ~/Desktop/mypemfile.pem" \
    ubuntu@myinstance(changed name).compute.amazonaws.com:/var/www/html/production/wp-content/uploads/ \

Some optimisations: don't use * on the source list (just ensure the path ends with /), and -r is implied by -a.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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