Passenger
Passenger

Reputation: 107

Zip the Folder in c# regardless of any number of subfolders inside it

I want to compress an entire directory which can have any number of subdirectories into a single ZIP file.I'm using the Ionic.Zip dll for that, but I don't know how to proceed.

private void ZipFiles(string zipPath, string sourceDirectory, string strfilename)
{
        using (ZipFile zip = new ZipFile())
        {
            zip.AddDirectory(sourceDirectory,zipPath);
                        
        }
}

Upvotes: 0

Views: 383

Answers (1)

d.popov
d.popov

Reputation: 4255

Try to use SevenZipSharp like that:

SevenZipCompressor compressor = new SevenZipCompressor();
compressor.CompressDirectory(...);

Upvotes: 0

Related Questions