Handle 7z Compressed File In VB.NET

4.4k views Asked by At

I need a specific help about 7z compress file. I hope all knows what is 7z file. It's a compress file format created by 7zip.

I have lot's of data I need to give to end user what is 10+ GB (after compressing with 7zip).

So, I compress the data using 7zip and split the files 1024MB (1GB). So, for example for 10GB Data it will be 10 files likes:

Data.7z.001
Data.7z.002
Data.7z.003
Data.7z.004
Data.7z.005
Data.7z.006
Data.7z.007
Data.7z.008
Data.7z.009
Data.7z.010

so, I put those data on 3 DVD disk.

I also made a extractor/installer (later I will call it my app) for that data.

my app use 7zip CLI (Command line interface) in background to extract the data. I put my installer also in the DVD.

Current Scenario:

Now user have to first copy all the disks (for this example 3 disk) in a single folder. Then run my installer to extract the file.

they have to put all the disk into single/same folder because 7z GuI/CLI doesn't support looking for not found files. by that I means for example if Data.006.7z file is missing it will not ask the user to browse and select that file. It will just abort the process with error message.

The Issue With Current Scenario: As mentioned above, user have to first copy all the disk into their hdd. It's have 3 major issue:

1. They must have that much space to copy all the disk in to same folder/drive
2. It will take so long to copy the disk then extract the data.
3. It need double space than it should :(

What I am looking for: I have seen 7zip have LZMA SDK. but don't have vb.net client library for that :(. I am looking to use that LZMA SDK in my vb.net project. So, I can handle those 7z files and overcome 7zip gui/issue.

So, my app will first extract the 7z files that found in disk 1 for example 001 to 004 then it ask for the 2nd disk and when user put 2nd disk it will continue from that number for example 005 and when done will ask for disk 3 when it needs and so on..

hope that makes sense ?

I know this is possible because I see some installer use LZMA to compress the files that could cover multiple disk and then installer install them correctly :)

so, can any one help me to achieve the goal? please?

thank in advance..

best regards

1

There are 1 answers

0
kevin rojas On

To decompress a file with 7z only need the first file

Dim exePath As String = "C:\Program Files\7-Zip\7z.exe"
Dim args As String = "e C:\DATA\TestData\K0080130001.7z.001" + " -o" "C:\DATA\TestData\New Folder\"""
System.Diagnostics.Process.Start(exePath, args)