简体   繁体   中英

SevenZipSharp in C# Compress files with all path folders

I have some code

SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");//x64    
var cmpr = new SevenZipCompressor();
cmpr.CompressionFinished += (s, e) => { dof.DoFinishEvent(); cmpr = null; };
cmpr.BeginCompressDirectory("C:\\58", "C:\\Table\files\today\58.7z");

This code is work, but when I open 58.7z I Must to open all folders(table/files/today and then I see what inside). Maybe isset some possible to save without absolute path? Thanks!

According to the source code , there is a boolean flag for exactly this purpose:

/// <summary>
/// Gets or sets the value indicating whether to preserve the directory structure.
/// </summary>
public bool DirectoryStructure { get; set; }

我找到解决办法

cmpr.DirectoryStructure = false;

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