C# 如何将整个文件夹添加到zip存档
我尝试了C# 如何将整个文件夹添加到zip存档,c#,dotnetzip,C#,Dotnetzip,我尝试了zip.AddDirectory功能,但我不知道如何将整个文件夹导入存档(使用DotNetZip) 我不想要这个: 但这是: 来自: 重新映射目录。压缩一组文件和目录,并将它们重新映射到压缩文件中的不同目录层次结构中: using (ZipFile zip = new ZipFile()) { // files in the filesystem like MyDocuments\ProjectX\File1.txt , will be stored in the zip ar
zip.AddDirectory
功能,但我不知道如何将整个文件夹导入存档(使用DotNetZip
)
我不想要这个:
但这是:
来自:
重新映射目录。压缩一组文件和目录,并将它们重新映射到压缩文件中的不同目录层次结构中:
using (ZipFile zip = new ZipFile())
{
// files in the filesystem like MyDocuments\ProjectX\File1.txt , will be stored in the zip archive as backup\File1.txt
zip.AddDirectory(@"MyDocuments\ProjectX", "backup");
// files in the filesystem like MyMusic\Santana\OyeComoVa.mp3, will be stored in the zip archive as tunes\Santana\OyeComoVa.mp3
zip.AddDirectory("MyMusic", "tunes");
// The Readme.txt file in the filesystem will be stored in the zip archive as documents\Readme.txt
zip.AddDirectory("Readme.txt", "documents");
zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ;
zip.Save(ZipFileToCreate);
}
你认为除了