title: Add Files to Tar Archive Without Copying Parent File Structure
body: <p>I'm creating a game in which a user can create custom content. There are two files associated with each custom creation: an .ogg file and a .xml file. Previously, I had a folder that contained all of the associated files, but I'd like to wrap all the associated files within a .tar file instead. </p>
  
  <p>Using the following code, I can create a .tar archive (with the custom extension ".krs"):</p>
  
  <pre><code>        FileInfo[] filesInDirectory = folder.GetFiles();
          string tarArchiveName = @"C:\Users\me\Desktop\UserData\songs\songName.krs";
  
          using (Stream targetStream = new GZipOutputStream(File.Create(tarArchiveName)))
          using (TarArchive tarArchive = TarArchive.CreateOutputTarArchive(targetStream, TarBuffer.DefaultBlockFactor))
          {
              foreach (FileInfo file in filesInDirectory)
              {
                  TarEntry entry = TarEntry.CreateEntryFromFile(file.FullName);
                  tarArchive.WriteEntry(entry, false);
              }
          }
  </code></pre>
  
  <p>This doesn't give any errors, but when I open the .krs file as a .tar using 7zip, the the files are buried underneath ALL the parent directories of the original files that were copied to the archive. For example, the path of the "data.xml" file within the .tar file is "C:\Users\me\Desktop\UserData\songs\songName\data.xml".</p>
  
  <p>I want to open the .tar file and there no top-level directory - just the two files. For example the data.xml file within the .tar archive should be simply "data.xml".</p>
  
  <p>I know this is achieveable because I can do it manually using 7zip. How can I do this using the SharpZipLib library in C#? I found <a href="https://stackoverflow.com/questions/5695881/how-do-i-tar-a-directory-without-retaining-the-directory-structure">this</a> answer that seems to address my problem, but it's written in Python, a language I have no understanding of.</p>
  
  <p><strong>EDIT:</strong> I did some more searching and found <a href="https://stackoverflow.com/questions/13900048/make-a-tar-gz-archive-without-folder-structure-using-sharpziplib">this</a> answer. I tried the solution, and it took away everything except the first parent directory of the files (".tar : parentFolder\data.xml"). Is it possible to remove that as well to avoid having to do any digging when I extract these files later?</p>