title: rsync using shopt globstar and **/. - how to exclude directories?
body: <p>I'm attempting to sync all files from within a large directory structure into a single root directory (ie not creating the sub directories but still including all recursive files).</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>Ubuntu 12.04 x86 </li>
  <li>RSYNC version 3.0.9</li>
  <li>GNU bash version 4.2.25(1)</li>
  </ul>
  
  <p>So far I have this command called from a bash script which works fine and provides the basic core functionality required:</p>
  
  <pre><code>shopt -s globstar
  rsync -adv /path/to/source/**/. /path/to/dest/. --exclude-from=/myexcludefile
  </code></pre>
  
  <p>The contents of <code>myexcludefile</code> are:</p>
  
  <pre><code>filename
  */ 
  # the */ prevents all of the directories appearing in /path/to/dest/
  
  # other failed attempts have included:
  directory1
  directory1/
  directory1/*
  </code></pre>
  
  <p>I now need to exclude files that are located inside certain directories in the source tree. However due to the globstar approach of looking in all directories rsync is unable to match directories to exclude. In other words, with the exception of my <code>/*</code> and <code>filename</code> rules, everything else is completely ignored.</p>
  
  <p>So I'm looking for some assistance on either the excludes syntax or if there's another way of achieving the rsync of many directories into a single destination directory that doesn't use my globstar approach.</p>
  
  <p>Any help or advice would be very gratefully received.</p>