vb.net workflow to upload .cab file and extract contents

Here is what I am looking to do:

1. Upload .cab file
2. Once .cab file is uploaded run a process to extract the file using 7-zip
3. Once the file is extracted perform additional processing that is already coded.

The problem is once i start the upload 7-zip wants to run right away before the file is complete. The .cab files can range in size from 30MB all the way up to 200MB so I don't think a timer is the best option. Ideally there must be some way to have a confirmation the file is uploaded and a confirmation on when the cab is extracted.
LVL 1
newimagentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
How are you uploading the file and how do you launch 7 zip?
0
newimagentAuthor Commented:
file is uploaded using the file upload control and a button to save the upload. 7-zip is launched using process.start
0
CodeCruiserCommented:
So you mean after calling the SaveAs on the file, and launching the 7-zip, the file is not written to disk yet?
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

newimagentAuthor Commented:
Yes, after calling the SaveAs 7-zip immediately starts. There needs to be a delay as the file is not fully uploaded when zip attempts to extract. how can i code in some kind of logic that makes sure the file is fully uploaded before the 7-zip process is kicked off?
0
CodeCruiserCommented:
The only way I can think of right now is that after calling the save method, add a while loop which keeps running and keeps trying to open the file. If there is an exception, it waits a bit and then tries again. If it succeeds, it exits the loop and launches 7-zip.
0
newimagentAuthor Commented:
I think you are on the right track. how can I write a do loop that checks if multiple files exist and once that returns true proceed with the processing? The below seems to be an infinite loop. I basically need the loop to check if the files exist and once they do run the CheckWinDC sub.


Do
            If File.Exists(txtPath.Text & "\SystemInfo\SysConfigResult.log") And File.Exists(txtPath.Text & "\SnapDriveInfo\SnapDrive_RegistryInfo.log") Then
                If rdoDataSource.SelectedIndex = 0 Then
                    CheckWinDC()
                    If rdoDataSource.SelectedIndex = 1 Then
                        'In the future this will be Check_nSANity
                    End If
                End If
            End If
        Loop

Open in new window

0
CodeCruiserCommented:
I would change it to below


While Not (File.Exists(txtPath.Text & "\SystemInfo\SysConfigResult.log") And File.Exists(txtPath.Text & "\SnapDriveInfo\SnapDrive_RegistryInfo.log") 
End While
                If rdoDataSource.SelectedIndex = 0 Then
                    CheckWinDC()
                    If rdoDataSource.SelectedIndex = 1 Then
                        'In the future this will be Check_nSANity
                    End If
                End If
            End If

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
May be add a thread.sleep within while.
0
newimagentAuthor Commented:
Thanks! That works!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.