DotNetZip - 而压缩重命名压缩文件文件条目 [英] DotNetZip - rename file entry in zip file while compressing
本文介绍了DotNetZip - 而压缩重命名压缩文件文件条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用DotNetZip,是否有可能压缩文件,从而压缩比磁盘上的文件名的文件列出了不同的文件名?例如,我想MYFILE.TXT添加到压缩文件,但我想它被称为otherFile.txt。
Using DotNetZip, is it possible to compress a file such that the zip lists a different file name for a file than the file name on disk? For example, I want to add myFile.txt to a zip file, but I want it to be called otherFile.txt.
推荐答案
从DotNetZip常见问题:
From the DotNetZip FAQ:
添加一个条目,在存档重写它的名字
using (ZipFile zip1 = new ZipFile())
{
zip1.AddFile("myFile.txt").FileName = "otherFile.txt";
zip1.Save(archiveName);
}
这篇关于DotNetZip - 而压缩重命名压缩文件文件条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文