Zip directory only includes first five folders


#1

I am trying to zip a directory with 8 sub folders, each containing one .csv file. Using the example for zipping a folder, the result only includes the first 5 of the original 8 sub folders. This is consistent across other input folders with varying number of subfolders. I am using a current Total license, is there an update needed? The .csv files for the first 5 folders in the result are intact.

        //creates zip folder 
        using (FileStream zipFile = File.Open(path + "Result.zip", FileMode.Create))
        {
            using (Archive archive = new Archive())
            {
                DirectoryInfo dir = new DirectoryInfo(path + "FolderToZip");
                archive.CreateEntries(dir, false);
                archive.Save(zipFile);
            }
        }

#2

@coozee06

We have tried the following code sample using Aspose.ZIP for .NET 18.11.1 and found it working fine. You may check compressed ZIP file here Result.zip (3.9 KB)

using (FileStream zipFile = File.Open(dataDir + "Result.zip", FileMode.Create))
{
    //FileInfo fi1 = new FileInfo(dataDir + "alice29.txt");
    //FileInfo fi2 = new FileInfo(dataDir + "fields.c");

    using (Archive archive = new Archive())
    {
        DirectoryInfo dir = new DirectoryInfo(dataDir + "FolderToZip");
        archive.CreateEntries(dir, false);
        archive.Save(zipFile);
    }
} 

It is requested to please try it with latest version of our API and please let us know if we have missed anything.
Moreover, if the issue still exists then share your file with us and also write us .NET version and OS details.


#3

Hello,

Thank you for such a quick reply. I can see the successful result you linked. However, this result has 8 nested folders, one inside the other. What we need is one archive with 8 folders all at the same level. And we only receive 5 in our output. Our original input directory has 8 folders all at the same level. If i set a breakpoint on archive.save(zipFile); I can see all 8 folders in the archive in memory. But that is not what gets written to disk after the save.

We are using .NET, specifically an APS.NET web application. We have tested Target Framework 4.5 as well as 4.7 and get the same result.
We are using Aspose.ZIP version 18.11.1, which appears to be the latest version from NuGet.

Thanks for for the assistance. We have been so happy with your products.


#4

@coozee06

We have reproduced this issue using Asp.NET MVC based Web application and it has been logged with ID “ZIPNET-279” for further investigation. You will automatically be informed here once we have more information to share.
Sorry for inconvenience in understanding the issue.


#5

@coozee06 @MuzammilKhan
Hello,
it seems you have not provided Aspose.Zip license before compression routine. Therefore, trial restrictions - no more than 10 entries, predefined comment for the whole archive - have been applied.


#6

Thanks for the response. I did not include the code before that compression snippet, but we are providing a license before that runs:

        Aspose.Cells.License license = new Aspose.Cells.License();
        var licensePath = System.Web.Hosting.HostingEnvironment.MapPath("~/App_LocalResources/");
        license.SetLicense(licensePath + "Aspose.Total.lic");

Does the Aspose.Zip library not included with an existing and current Total license?


#7

@coozee06

Please try applying the same Total license with Aspose.Zip.License class object.


#8

That did the trick. Thanks for pointing that out. We are using both Cells and Zip. I did not realize instantiating each library license is required.


#9

@coozee06

Thank you very much for your feedback. We are glad to know that your issue is resolved. You are always welcome and please feel free to write us if you have any query in future.