Search code examples
c#cab

Create a cab without a folder


I am trying to create a cab file that composes of 3 files. I am using WiX dlls as recommended on another page. The problem I face is that I need the files compressed without creating a folder. When I use the below method and extract the files once again, the compressed files are now houses within a folder of the same name as the cab file.

Is it possible create the file without the folder?

Here is my code

        CabInfo cab = new CabInfo(@"c:\cab\test.cab");
        List<String> files = new List<string>();
        files.Add(@"C:\cab\test.D");
        files.Add(@"C:\cab\test.L");
        files.Add(@"C:\cab\test.U");
        cab.PackFiles(null, files, null);

extracted files

-test
   -test.D
   -test.L
   -test.U

Solution

  • The problem comes from the program that extracts the .cab file. Nothing can be done at compression side.

    If the decompressor is yours, it can be made to extract files directly. 7-Zip has the option to not create the folder too.

    There is nothing in the format of an archive (.cab or anything else) that can prevent that folder creation.