1
我使用离子拉链拉上特定文件夹排除在备份文件夹(创建备份云)的所有文件夹。Ionic.Zip的ArgumentException(具有相同键的项已被添加)
这是我的代码:
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));
,但增加了一些目录后,我发现了以下错误:
An item with the same key has already been added.
这怎么可能?如何可能在同一父文件夹中的文件夹列表中重复名称?