ComponentPro UltimateZip

      Working with Tar, Tgz, and Gzip archivers

      Language Filter: AllSend comments on this topic to ComponentPro

      It's very easy to transfer files from a Zip file to another archive in different format like Tar, Tgz or GZip. Zip, Tar, Tgz, Gzip and RealTimeZip classes inherit from the FileSystem class which is very powerful and convenient for transferring files and folders. The following example demonstrates how to transfer files and folders between two archives in different formats.

      using ComponentPro.Compression;
      using ComponentPro.IO;
      // Create a new instance.
      Zip zip = new Zip();
      // Open an existing archive.
      // Add a directory from another TAR archive
      Tar tar = new Tar();
      // Open a Tar file.
      zip.AddFiles(tar, "/abc", true, null, "", new TransferOptions());
      // Close the tar archive.
      // Extract files within the Zip archive to a TGZ archive.
      Tgz tgz = new Tgz();
      // Create new TGZ file.
      TransferOptions opt = new TransferOptions();
      zip.ExtractFiles("/", false, (FileInfoBase[])null, tgz, "", opt);
      // Close the Tgz file.
      // Extract a file from the Zip archive to z GZip file.
      Gzip gzip = new Gzip();
      zip.ExtractFile("/abc/test.txt", gzip, "test.txt");
      // Close the zip file.