![](/img/trans.png)
[英]Adding a file to a specific path in a 7-zip archive using SevenZipSharp
[英]SevenZipSharp - Append files to zip and remove file path
我正在使用SevenZipSharp将文件压缩为zip文件。 我有两个问题:
在同一目标文件上使用CompressFiles多次,它不会附加文件,但会覆盖它们。
我希望文件添加完整的路径,但似乎无法找到(我认为PreserveDirectoryRoot = false会做的伎俩,但它没有)。
有没有人有想法?
您需要在第一次调用后使用CompressionMode.Append
。 默认值为CompressionMode.Create
。 可以通过更改DirectoryStructure
来删除路径。
相关的源代码在这里 。
public sealed partial class SevenZipCompressor
#if UNMANAGED
: SevenZipBase
#endif
{
/// Gets or sets the compression mode.
/// </summary>
public CompressionMode CompressionMode { get; set; }
/// <summary>
/// Gets or sets the value indicating whether to preserve the
/// directory structure.
/// </summary>
public bool DirectoryStructure { get; set; }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.