I'm using Ionic Zip to zip all folders in a specific folder excluding the backup folder (which created backups goes).
This is my code:
ZipFile zip = new ZipFile();
string mainpath = HttpContext.Current.Server.MapPath("~/");
Directory.GetDirectories(mainpath).Where(d=> !d.ToLower().EndsWith("backup")).ToList()
.ForEach(d=> zip.AddDirectory(d));
but after adding some directories, I'm getting the following error:
An item with the same key has already been added.
How is it possible? How can possibly be duplicate names in the folder list in the same parent folder?