Results 1 to 8 of 8

Thread: DotNetZip UnZip/Zip with file locations

Threaded View

  1. #1

    Thread Starter
    Addicted Member HunterTTP's Avatar
    Join Date
    Jul 2012
    Posts
    146

    Question DotNetZip UnZip/Zip with file locations

    I've got the problem narrowed down, I just don't know how to fix it.

    Here is an example code-

    Variables for example:
    Code:
    Dim Username As String = Environment.UserName
        Dim AppData As String = "C:\Users\" & Username & "\AppData\Roaming"
    Zip and UnZip subs:
    Code:
    Public Sub MyZip(ByVal ContentFolder As String, ByVal CreateZip As String)
            Using zip As ZipFile = New ZipFile()
                zip.AddDirectory(ContentFolder)
                zip.Save(CreateZip)
            End Using
        End Sub
    Code:
    Public Sub MyExtract(ByVal ZipToUnpack As String, ByVal UnpackDirectory As String)
            Using zip As ZipFile = ZipFile.Read(ZipToUnpack)
                Dim e As ZipEntry
                For Each e In zip
                    e.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
                Next
            End Using
        End Sub
    How I call the subs:
    Code:
    MyExtract(AppData & "\test.zip", AppData & "\testdirectory")
    
    MyZip(AppData & "\testdirectory", AppData & "\test.zip")
    All this works fine, but the problem is that DotNetZip will not take file locations in this form. I get this weird "FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path." error. If I just put the zip and folder names (instead of locations + names) it works fine but only looks in it's local directory. How do I get it to function as I need it to?
    Last edited by HunterTTP; Nov 22nd, 2012 at 09:31 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width