开发者

SevenZipSharp - Append files to zip and remove file path

开发者 https://www.devze.com 2023-01-24 23:36 出处:网络
I am using SevenZipSharp in order to compress files into a zip file. I am having 2 issues: When using CompressFiles miltiple times on the same destination file it does not append t开发者_C百科he fil

I am using SevenZipSharp in order to compress files into a zip file. I am having 2 issues:

  1. When using CompressFiles miltiple times on the same destination file it does not append t开发者_C百科he files, but overwrites them.

  2. I would like the files to be added with out their whole path but can't seem to find how (I thought that PreserveDirectoryRoot = false would do the trick but it does not).

Does anyone have an idea?


You need to use CompressionMode.Append after the first call. The default is CompressionMode.Create. Path can be dropped by altering DirectoryStructure.

Relevant source code is here.

    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; }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号