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. zip.Open("test.zip"); // Add a directory from another TAR archive Tar tar = new Tar(); // Open a Tar file. tar.Open("test.tar"); zip.AddFiles(tar, "/abc", true, null, "", new TransferOptions()); // Close the tar archive. tar.Close(); // Extract files within the Zip archive to a TGZ archive. Tgz tgz = new Tgz(); // Create new TGZ file. tgz.Create("test.tgz"); TransferOptions opt = new TransferOptions(); zip.ExtractFiles("/", false, (FileInfoBase[])null, tgz, "", opt); // Close the Tgz file. tgz.Close(); // Extract a file from the Zip archive to z GZip file. Gzip gzip = new Gzip(); gzip.Create("test.gz"); zip.ExtractFile("/abc/test.txt", gzip, "test.txt"); gzip.Close(); // Close the zip file. zip.Close();