title: Create a single tar file for multiple directories by excluding its parent folders
body: <p>I'm working on a bash shell script which creates a tar file for multiple folders by excluding its parent folders to all the directories and also exclude specified folder.</p>
  
  <p>The directory structure is:</p>
  
  <pre><code>$ ls dir1
  dir11 testdir
  
  $ ls dir2
  dir12 testdir2
  
  $ ls dir3
  dir13 testdir3
  
  $ tar -cvf file1.tar dir1 dir2 dir3 --exclude="test*"
  </code></pre>
  
  <p>The above works fine.</p>
  
  <p>But I dont want the dir1, dir2 and dir3 folders also in tar. I need only inside the files and directories.</p>
  
  <p>So my final tar should contain as following</p>
  
  <pre><code>$ tar -tvf file1.tar
  dir11 dir12 dir13
  </code></pre>
  
  <p>Can anyone help me out to solve this one. Thanks inadvance</p>