2012-10-15 9 views

답변

16

CodeProject 기사에서 살펴 경우 당신을 도움이 될 것입니다. 특정 문제가있는 경우 질문에 코드 및 문제 설명을 넣어야합니다.

:

Sub UnZip() 
    Dim sc As New Shell32.Shell() 
    'Create directory in which you will unzip your files . 
    IO.Directory.CreateDirectory("D:\extractedFiles") 
    'Declare the folder where the files will be extracted 
    Dim output As Shell32.Folder = sc.NameSpace("D:\extractedFiles") 
    'Declare your input zip file as folder . 
    Dim input As Shell32.Folder = sc.NameSpace("d:\myzip.zip") 
    'Extract the files from the zip file using the CopyHere command . 
    output.CopyHere(input.Items, 4) 

End Sub 

링크


아니면 닷넷 4.5을 사용하는 경우이 링크에서 ZipFile Class

예를 사용할 수있는 방법 Folder.CopyHere에 대한 : 위의 문서에서

Imports System.IO 
Imports System.IO.Compression 

Module Module1 

    Sub Main() 
     Dim startPath As String = "c:\example\start" 
     Dim zipPath As String = "c:\example\result.zip" 
     Dim extractPath As String = "c:\example\extract" 

     ZipFile.CreateFromDirectory(startPath, zipPath) 

     ZipFile.ExtractToDirectory(zipPath, extractPath) 
    End Sub 

End Module 
+0

와우, 고마워요. – kelvz

+1

@kelvz 다음에 답을 고르지 만 다른 좋은 질문이 있습니다. 적어도 +1하십시오. – Anonymous

6

나는 당신이 http://dotnetzip.codeplex.com/를 다운로드 한 다음이 (문서에서 가져온 예)처럼 사용하는 것이 좋습니다 것입니다.

Dim ZipToUnpack As String = "C1P3SML.zip" 
Dim TargetDir As String = "C1P3SML" 
Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir) 
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack) 
    Dim e As ZipEntry 
    For Each e In zip1 
     e.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently) 
    Next 
End Using 
+0

고맙습니다 .. 아프세요. – kelvz

+0

그게 작동하지 않습니다 : ( – kelvz

+0

내 오류는 "MyExtractProgress" – kelvz