使用SharpZipLib压缩空目录

5
2个回答

5

只有文件名不能使用utf-8编码吗?我可以打包一个文件名为aa.txt的utf-8文本文件吗? - nirmus
@nirmus - 只需要文件名。 - Eric H
非常感谢,现在在zip文件中我有一个空目录,但是如果我使用FastZip.ExtractZip,就不会有这个空目录了;) 很有趣;p - nirmus
1
@nirmus- 在提取之前也要做同样的事情。 FastZip fs = new FastZip(); fs.CreateEmptyDirectories = true; fs.ExtractZip(destinationFile, unpackedPath, null); - New Developer

4
你可以让程序将文件夹添加为条目。
在循环每个文件夹的代码中添加以下代码。
//Here we create a path for a new entry,
//but this time with the '\' in the end, its a folder
string sEntry = sFolder.Substring(iFolderOffset) + "\\";
sEntry = ZipEntry.CleanName(sEntry);
ZipEntry zeOutput = new ZipEntry(sEntry);
zsOutput.PutNextEntry(zeOutput);
zsOutput.CloseEntry();

我还没有测试解压缩功能。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接