Question

I am using SharpZipLib and I need to zip an existing folder where there are files inside it.

Example: I need to zip "Folder2"

C:\Folder1\Folder2

Folder2 has two files a.txt and b.txt

My current code uses "FastZip"

        FastZip fastzip = new FastZip();
        Boolean recurse = true;
        String filter = null;

        fastzip.CreateZip(folderName, @"\" + folderName, recurse, filter);

I get an error of:

Access to path C:\Folder1\Folder2 is denied.

Any experts out here on SharZipLib? :)

Was it helpful?

Solution

I would have expected c:\folder1\folder2 passing it folder2 as the option as you dont show all your code, to fail.

I would hope the following might work assuming foldername = "c:\folder1\folder2"

FastZip fastzip = new FastZip(); 
        Boolean recurse = true; 
        String filter = null; 

        fastzip.CreateZip("azip.zip",  folderName, recurse, filter);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top