title: tar: unable to include folder but exclude content
body: <p>I have a project folder with several directories</p>
  
  <pre><code>- archive 
  - include
  - lib
  - src
  - src/obj (obj is a subdirectory of src)
  </code></pre>
  
  <p>I would like <code>tar</code> to pack these directories and their contents into a <code>main.tar</code>, then I will the <code>main.tar</code> into the <code>archive</code> directory.  </p>
  
  <pre><code>tar cvz \
      --exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*" \
      -f main.tar \
      ./archive ./include ./lib ./src
  </code></pre>
  
  <p>I would like to exclude the contents of the <code>archive</code> directory but still package the empty directory itself.  You can see I am also excluding some other stuff from various places, OSX likes to write .DS_Store files everywhere on my filesystem and I occasionally make copies of files and append <code>.obsolete</code> to the end while working on a new version.</p>
  
  <p>Unfortunately, the empty <code>archive</code> directory is <em>not</em> included in <code>main.tar</code>.
  According to <a href="https://serverfault.com/questions/618702/in-tar-how-can-i-exclude-dir-contents-but-leave-empty-dir">this thread</a>, my command <em>should</em> work.  </p>
  
  <p>How can the files be excluded from <code>archive</code> but the empty directory be packed into the tar file?</p>