简体   繁体   中英

SevenZipSharp - Append files to zip and remove file path

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM