Ionic Zip folder structure

darrenwild

New Member
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:\[code\]Root ( -subfolder1 -subfolder2 individual file individual file individual file)\[/code\]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....\[code\]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") NextEnd Using\[/code\]however, the \[code\]zip.addfile(item.innertext)\[/code\] line addes the individual files to the full path. So, if the file is \[code\]C:\Pictures\image.jpg\[/code\] ...it will appear as such in the zip file, with all the subfolders.I have also tried things like \[code\]zip.addfile(item.innertext, "individual files")\[/code\] to create a folder for just individual files...but meh, i want those files to be stored in the root.Any suggestions?
 
Back
Top