Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

rsync without overwriting existing files

rsync -av —ignore-existing source/ destination/
https://snipt.net/embed/d77ffa932d4d210a16a7b99eb41a412f/
https://snipt.net/raw/d77ffa932d4d210a16a7b99eb41a412f/
d77ffa932d4d210a16a7b99eb41a412f
bash
Bash
1
2016-12-10T12:14:05
True
False
False
Oct 04, 2013 at 08:39 PM
/api/public/snipt/85706/
rsync-without-overwriting-existing-files
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -av —ignore-existing source/ destination/ </span></pre></div> </td></tr></table>
rsync

Bash

rsync

rsync -av /where you want it from/ /where you want it too/
https://snipt.net/embed/89c3491da0f5c3abe74f676deec7b8ab/
https://snipt.net/raw/89c3491da0f5c3abe74f676deec7b8ab/
89c3491da0f5c3abe74f676deec7b8ab
bash
Bash
1
2016-12-10T07:04:02
True
False
False
Feb 13, 2013 at 08:34 PM
/api/public/snipt/55725/
rsync-7
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -av /where you want it from/ /where you want it too/ </span></pre></div> </td></tr></table>
rsync

Bash

Rsync by especific extension

1
2
3
#Syncronize all files with extension flv and swf to destination, including paths,
#but exclude all other files
rsync -av --include '*/' --include '*.flv' --include '*.swf' --exclude '*' /source/ /destination/
https://snipt.net/embed/eca73edaf3be0619fb996af927340958/
https://snipt.net/raw/eca73edaf3be0619fb996af927340958/
eca73edaf3be0619fb996af927340958
bash
Bash
3
2016-12-09T13:05:07
True
False
False
Sep 04, 2012 at 09:21 AM
/api/public/snipt/46676/
rsync-by-especific-extension
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#Syncronize all files with extension flv and swf to destination, including paths,</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">#but exclude all other files</span> </span><span id="L-3"><a name="L-3"></a>rsync -av --include <span class="s1">&#39;*/&#39;</span> --include <span class="s1">&#39;*.flv&#39;</span> --include <span class="s1">&#39;*.swf&#39;</span> --exclude <span class="s1">&#39;*&#39;</span> /source/ /destination/ </span></pre></div> </td></tr></table>
rsync

Text only

find symbolic links and rsync them

find /path/to/files -type l -print | rsync -av --files-from=- /path/to/files [email protected]:/path
https://snipt.net/embed/5ac962e475e149403266a1f183730c5d/
https://snipt.net/raw/5ac962e475e149403266a1f183730c5d/
5ac962e475e149403266a1f183730c5d
text
Text only
1
2016-12-10T14:03:37
True
False
False
Aug 29, 2012 at 07:35 PM
/api/public/snipt/46476/
find-symbolic-links-and-rsync-them
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find /path/to/files -type l -print | rsync -av --files-from=- /path/to/files [email protected]:/path </span></pre></div> </td></tr></table>
find, rsync

Bash

rsync move files to server

rsync -arzv -e ssh folder [email protected]:/destination-folder
https://snipt.net/embed/5257113eb28985496906572ddb047234/
https://snipt.net/raw/5257113eb28985496906572ddb047234/
5257113eb28985496906572ddb047234
bash
Bash
1
2016-12-07T08:28:43
True
False
False
/api/public/snipt/38711/
rsync-move-files-to-server
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -arzv -e ssh folder [email protected]:/destination-folder </span></pre></div> </td></tr></table>
rsync, ssh

Bash

My rsync command

rsync -rtv --delete --size-only --progress -e ssh $ORIGIN $USER@$SERVER:~/$DEST
https://snipt.net/embed/93186811decde1b8c3660cf677f2e4b0/
https://snipt.net/raw/93186811decde1b8c3660cf677f2e4b0/
93186811decde1b8c3660cf677f2e4b0
bash
Bash
1
2016-12-09T17:46:07
True
False
False
/api/public/snipt/27840/
my-rsync-command
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -rtv --delete --size-only --progress -e ssh <span class="nv">$ORIGIN</span> <span class="nv">$USER</span>@<span class="nv">$SERVER</span>:~/<span class="nv">$DEST</span> </span></pre></div> </td></tr></table>
rsync, sftp, ssh

Bash

Quick rsync

1
2
3
4
5
svn update

find . \( -not -ipath *.svn* -not -iname changed-list.txt \) -mmin -60 > ./changed-list.txt

rsync -v --files-from=./changed-list.txt . [email protected]:/path/to/code/directory
https://snipt.net/embed/1e4b90cca7a7c682270f3ddab1df9978/
https://snipt.net/raw/1e4b90cca7a7c682270f3ddab1df9978/
1e4b90cca7a7c682270f3ddab1df9978
bash
Bash
6
2016-12-07T08:19:13
True
False
False
/api/public/snipt/27794/
quick-rsync
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>svn update </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>find . <span class="se">\(</span> -not -ipath *.svn* -not -iname changed-list.txt <span class="se">\)</span> -mmin -60 &gt; ./changed-list.txt </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>rsync -v --files-from<span class="o">=</span>./changed-list.txt . [email protected]:/path/to/code/directory </span></pre></div> </td></tr></table>
bash, command, rsync, svn
Copyrighted, illegal, or inappropriate content? Email [email protected].