title: tar (on Windows) a list of files in c#
body: <p>I then to tar and then gzip a list of files in C#.</p>
  
  <p>I need some help with how to set the arguments to tar.</p>
  
  <p>Say I have tar.exe in a folder c:\tar\tar.exe and a method like the following:</p>
  
  <pre><code>    private void RunTar(string outputFileName, List&lt;string&gt; fileNamePaths)
      {
          using (Process p = new Process())
          {
              p.StartInfo.FileName = @"c:\tar\tar.exe";
              p.StartInfo.Arguments = //;
              p.Start();
              p.WaitForExit();
          }
      }
  </code></pre>
  
  <p><strong>Note: the fileNamePathsToTar list has the full unc filename paths and the files can be in different folders.</strong></p>
  
  <p>Can anyone please help with what <strong>arguments</strong> to supply.</p>
  
  <p>Also I notice in the documentation:</p>
  
  <pre><code>-z, --gzip, --ungzip
            filter the archive through gzip
  
     -Z, --compress, --uncompress
            filter the archive through compress
  
     --use-compress-program=PROG
            filter through PROG (must accept -d)
  </code></pre>
  
  <p>Not sure how to use this but if I place the gzip.exe in the same folder as tar.exe <strong>can I perform my tar and then gzip of these files all in one step</strong>?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I can only seem to get tar to work on files in the same directory as tar.exe if I try a full path name I get something like:</p>
  
  <pre><code>    C:\Tar Test&gt;tar -cf out.tar c:/Tar Test/Text/t1.txt
  tar: Cannot add file c:/Tar: No such file or directory
  tar: Cannot add file Test/Text/t1.txt: No such file or directory
  tar: Error exit delayed from previous errors
  </code></pre>
  
  <p>I've tried with the slashes both ways \ or / and with quotes around the full path no joy.</p>
  
  <p>Thanks</p>