[英]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.