So I have a application that zips directories and it works perfectly except that today I got an exception and when I checked the log it turned out that it got a system out of memory exception because of this directory that is ~550mb. So my question is: Is there a way to get around this or enable my application to work with bigger sized directories?
Here is the code that zips the directories:
using (FileStream zipToOpen = new FileStream(destdir1, FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
int ind = folder.LastIndexOf("\\") + 1;
string folderName = folder.Substring(ind, folder.Length - ind);
ZipArchiveEntry readmeEntry;
DirectoryInfo d = new DirectoryInfo(folder);
FileInfo[] Files = d.GetFiles("*");
foreach (FileInfo file in Files)
{
readmeEntry = archive.CreateEntryFromFile(folder + "\\" + file.Name, folderName + "/" + file.Name);
}
DeleteDirectory(folder);
}
}