title: How can I extract a file from a tar archive without creating the subdirectories?
body: <p>I have a compressed tar archive and I want to extract one file from deep in the archive to the current working directory.</p>
  
  <p>Is there something better than <code>tar</code>, or a way to extract it without the directory components?</p>
  
  <p>I'm doing something like this right now:</p>
  
  <pre><code>tar xfvz $file -C $destination $folder"/"$file
  cd $destination"/"$folder
  mv $file ../$file 
  rm -r $folder
  </code></pre>
  
  <p>But I sometimes delete the wrong <code>$folder</code>.</p>
  
  <p>For example, my archive is : <code>mytar.tar.gz</code>.
  Inside it I have <code>myfolder/mysecondfolder/hello.txt</code>.</p>
  
  <p>I want to extract <code>myfolder/mysecondfolder/hello.txt</code> as <code>hello.txt</code> in the current directory.</p>