.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Generating a zipOutputstream from a folder having other .zip files in it

Posted By: watson     Posted Date: October 04, 2013    Points:5   Category :C#
I am trying to convert an entire azure blob storage folder and its contents to a zip file .Inside this folder ,I have different types of files eg, .txt,.mp3,.zip files .But once the folder is converted to zip file I noticed that all the .zip file types got corrupted,.How can I prevent my zip files from corrupted. I am using Ionic.Zip library to generate zip files

Here is the code I am using .Here I am able to generate and download the zip file successfully with all other filetypes *except the inner zip files*.

var allFiles = directory.ListBlobs(new BlobRequestOptions { UseFlatBlobListing = true }).Where(x => x.GetType() == typeof(CloudBlockBlob)).Cast<CloudBlob>();
string xyzblob = directory.Uri.ToString().TrimEnd('/');
var dBlob = blobClient.GetBlobReference(xyzblob);
byte[] fileBytes = null;
fileBytes = dBlob.DownloadByteArray();

foreach (var file in allFiles)
using (var fileStream = new MemoryStream(fileBytes))
var entryName = file.Uri.ToString().Replace(directory.Uri.ToString(), "");
fileStream.Seek(0, SeekOrigin.Begin);
int count = fileStream.Read(fileBytes, 0, fileBytes.Length);
while (count > 0)
zipOutputStream.Write(fileBytes, 0, count);

count = fileStream.Read(fileBytes, 0, fileBytes.Length);
if (!Response.IsClientConnected)



No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend