0

In my Application im using the SevenZipSharp library and I want to compress an Array of Files. Each of my Files is in the same Directory, for example:

  • abc/xyz/file1.txt
  • abc/xyz/file2.txt

When I call the Method CompressFiles, it cuts my Directory from the Compression while I want to keep the "xyz" Path of my Files. Is there a way to achieve this? Or do I have to use the CompressDirectory Method for this?

Example:

var myCompressor = new SevenZipCompressor
{
    ArchiveFormat = OutArchiveFormat.SevenZip,
    CompressionMethod = CompressionMethod.Lzma2,
    PreserveDirectoryRoot = true,
    DirectoryStructure = true,
    IncludeEmptyDirectories = true
};
string[] files = new string[2] { "abc/xyz/file1.txt", "abc/xyz/file2.txt" }
myCompressor.CompressFiles("somePath", files);

Result:

  • Archive
    • file1.txt
    • file2.txt

What I want:

  • Archive
    • xyz
      • file1.txt
      • file2.txt
Febertson
  • 398
  • 4
  • 23
  • example here: https://community.dynamics.com/crm/b/cupofdev/archive/2014/10/15/compress-files-and-folders-using-sevenzipsharp-and-7-zip-in-c – jazb Oct 12 '18 at 05:54
  • Thanks for the Link, but as I stated in my Question. I know about the CompressDirectory Call. My Question is, if you can achive this with the CompressFiles Method. – Febertson Oct 12 '18 at 05:59

0 Answers0