snipt

Ctrl+h for KB shortcuts

Bash

simple rsync command with ignore file

# my-sync.sh
#!/bin/sh

rsync -avv --recursive --exclude-from sync-ignore.txt --progress path/to/local/directory [email protected]:/path/to/remove/directory


# Example: sync-ignore.txt
.git
.DS_Store
*.pyc
https://snipt.net/embed/d9d4b1fa7cea2828fb9271a65d2f3d41/
/raw/d9d4b1fa7cea2828fb9271a65d2f3d41/
d9d4b1fa7cea2828fb9271a65d2f3d41
bash
Bash
10
2019-08-21T00:58:22
True
False
False
/api/public/snipt/12891/
simple-rsync-command-with-ignore-file
<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> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</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"># my-sync.sh</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">#!/bin/sh</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>rsync -avv --recursive --exclude-from sync-ignore.txt --progress path/to/local/directory [email protected]:/path/to/remove/directory </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="c1"># Example: sync-ignore.txt</span> </span><span id="L-8"><a name="L-8"></a>.git </span><span id="L-9"><a name="L-9"></a>.DS_Store </span><span id="L-10"><a name="L-10"></a>*.pyc </span></pre></div> </td></tr></table>
bash, ignore, rsync