bigjoy10
bigjoy10

Reputation: 55

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!

Upvotes: 0

Views: 1997

Answers (2)

bigjoy10
bigjoy10

Reputation: 55

I find solution

cmpr.DirectoryStructure = false;

Upvotes: 0

JensG
JensG

Reputation: 13411

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

Upvotes: 1

Related Questions