Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:46:20+00:00 2026-06-15T13:46:20+00:00

I am trying to add some zipping code to my program, however, i can’t

  • 0

I am trying to add some zipping code to my program, however, i can’t seem to get the folder structure just right.

I want the folder to look like this:

Root (
   -subfolder1
   -subfolder2
   individual file
   individual file
   individual file)

So, the indidivual files will be in the root folder of the zip and the folders that i add will become subfolders to the root. my code is below….

Using zip As New ZipFile()
    For Each item As System.Xml.XmlNode In Source
        If item.InnerText.Contains(".") Then
            zip.AddFile(item.InnerText)
        Else
            zip.AddDirectory(item.InnerText, GetLastDirName(item.InnerText))
        End If
    Next

    For Each item As System.Xml.XmlNode In Destin
        Dim path As String = item.InnerText
        zip.Save(path.Replace(".zip", "") & "_Archive_" & DateString & ".zip")
    Next
End Using

however, the zip.addfile(item.innertext) line addes the individual files to the full path. So, if the file is C:\Pictures\image.jpg …it will appear as such in the zip file, with all the subfolders.

I have also tried things like zip.addfile(item.innertext, "individual files") to create a folder for just individual files…but meh, i want those files to be stored in the root.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:46:21+00:00Added an answer on June 15, 2026 at 1:46 pm

    If you look at the documentation for the method AddFile, there are two parameters you can pass in:

    1. The file name
    2. The directory path in archive.

    The Ionic documentation states that for that second parameter, the rules are as follows:

    Specifies a directory path to use to override any path in the
    fileName. This path may, or may not, correspond to a real directory in
    the current filesystem. If the files within the zip are later
    extracted, this is the path used for the extracted file. Passing null
    (Nothing in VB) will use the path on the fileName, if any. Passing the
    empty string (“”) will insert the item at the root path within the
    archive.

    Source (http://dotnetzip.herobo.com/DNZHelp/html/202e1fb5-8891-888f-8e91-1340f7cd80c9.htm)

    The means that in your code above, where you pass in only the first parameter (file name), you will use the full path off of the file you’re adding. Add the path you want to the AddFile method as your second parameter, and you’re good to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to add some non-production test code by creating a 3rd partial
just trying to add some setting for the admin in a database entry. i've
Just trying to add some text before function's result. onClick=$('#itempriceqty0').clone().appendTo('#itempricewrapper').attr('id', $('#itempricewrapper').children().length-5+1) So I need
I am trying to add some assembly info for log4net so that it can
I'm trying to add some behavior for the right click event. Weirdly I simply
I'm trying to add some user controls on a page. Thats easy, I just
Im trying to add some callback to my code, so when clicking on a
i'm trying to add some html code with javascript and jQuery into a div
I am trying to add some validation to a form just before it is
I am trying to add some validation for my registration form, but i can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.