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:
When using CompressFiles miltiple times on the same destination file it does not append t开发者_C百科he files, but overwrites them.
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; }
}
精彩评论