pages tagged rsync http://meng6net.localhost/tag/rsync/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Sat, 27 Mar 2021 22:58:13 +0000 Examples of using rsync http://meng6net.localhost/computing/example/examples_of_using_rsync/ http://meng6net.localhost/computing/example/examples_of_using_rsync/ computing documentation example rsync Tue, 16 May 2017 23:59:39 +0000 2021-03-27T22:58:13Z <h2>Publishing static content of a web site</h2> <p>Publish web site composed of static files and directories in directory <code>~/subdir/</code> on local machine to web site directory <code>~/dir/subdir</code> on remote server</p> <pre> <code>$ rsync -thrivpbl ~/mysite/ foouser@host.domain.com:~/dir/msite </code></pre> <p>or</p> <pre> <code>$ rsync -zhavib ~/mysite/ foouser@host.domain.com:~/dir/mysite </code></pre> <ul> <li><code>-a</code> equals <code>-rlptgoD</code> <ul> <li><code>-r</code> recursive</li> <li><code>-l</code> preserve links</li> <li><code>-p</code> preserve permissions</li> <li><code>-t</code> preserve time stamp</li> <li>If copying on the same computer: <ul> <li><code>-g</code> preserve group</li> <li><code>-o</code> preserve owner</li> <li><code>-D</code> or <code>--devices</code> preserve device files</li> </ul> </li> </ul> </li> <li><code>-h</code> report human readable numbers</li> <li><code>-i</code> report itemized list of the changes to each file, including attribute changes.</li> <li><code>-v</code> verbose</li> <li><code>-b</code> backup</li> <li><code>-z</code> compress file data during transfer</li> </ul> <h3>Verbose output (<code>-v</code>)</h3> <p>Some common indicators:</p> <ul> <li><code>&gt;f+++++++++</code>: recieving (<code>&gt;</code>) a regular file (<code>f</code>) which is newly created (<code>+</code>).</li> <li><code>&lt;f.st......</code>: sending (<code>&lt;</code>) a regular file (<code>f</code>) whose size (<code>s</code>) and time stamp (<code>t</code>) are different.</li> <li><code>&gt;f.st......</code>: recieving (<code>&gt;</code>) a regular file (<code>f</code>) whose size (<code>s</code>) and time stamp (<code>t</code>) are different.</li> <li><code>.d..t......</code>: not updating (initial <code>.</code>) a directory (<code>d</code>) whose time stamp (<code>t</code>) is different.</li> </ul> <p>References: <a href= "http://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs"> http://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs</a></p> <h2>Safely copying large file</h2> <pre> <code>$ sudo rsync -vahzi --progress /Volumes/large_file.mp4 /Volumes/new_file.mp4 </code></pre> <h2>Safely copying a large directory</h2> <pre> <code>$ sudo rsync -vahzi --progress /Volumes/large_dir/ /Volumes/new_dir </code></pre> <h2>Installing up-to-date rsync via Homebrew on macOS</h2> <p>The version of <code>rsync</code> coming with macOS operating system is an older version (<code>2.*</code> as of OS X 10.10.2). To install the more up-to-date version,</p> <pre><code>brew doctor brew upgrade brew tap homebrew/dupes brew install rsync </code></pre> <p>Make sure the path Homebrew installs softwares to, <code>/usr/local/bin</code> appears before other paths in <code>/private/etc/paths</code> so it's searched first. Restart the terminal.</p>