Bookmark and Share

Publishing static content of a web site

Publish web site composed of static files and directories in directory ~/subdir/ on local machine to web site directory ~/dir/subdir on remote server

$ rsync -thrivpbl ~/mysite/


$ rsync -zhavib ~/mysite/
  • -a equals -rlptgoD
    • -r recursive
    • -l preserve links
    • -p preserve permissions
    • -t preserve time stamp
    • If copying on the same computer:
      • -g preserve group
      • -o preserve owner
      • -D or --devices preserve device files
  • -h report human readable numbers
  • -i report itemized list of the changes to each file, including attribute changes.
  • -v verbose
  • -b backup
  • -z compress file data during transfer

Verbose output (-v)

Some common indicators:

  • >f+++++++++: recieving (>) a regular file (f) which is newly created (+).
  • < sending (<) a regular file (f) whose size (s) and time stamp (t) are different.
  • > recieving (>) a regular file (f) whose size (s) and time stamp (t) are different.
  • .d..t......: not updating (initial .) a directory (d) whose time stamp (t) is different.


Safely copying large data

$ sudo rsync -vahzi --progress /Volumes/SourceName /Volumes/DestinationName

Installing up-to-date rsync via Homebrew on macOS

The version of rsync coming with macOS operating system is an older version (2.* as of OS X 10.10.2). To install the more up-to-date version,

brew doctor
brew upgrade
brew tap homebrew/dupes
brew install rsync

Make sure the path Homebrew installs softwares to, /usr/local/bin appears before other paths in /private/etc/paths so it's searched first. Restart the terminal.

blog comments powered by Disqus