I need to create zip folders containing multiple files that will have the same filename, but different file extension. For example, in one folder I will have:
- Field 1.shp
- Field 1.shx
- Field 1.prj
- Field 1.dbf
- Field 2.shp
- Field 2.shx
- Field 2.prj
- Field 2.dbf
etc..
I need to zip all Field 1 files together in Field 1.zip, Field 2 files together in Field 2.zip etc. looping through the folder.
Here I am currently:
Private Sub btnZipFiles_Click(sender As Object, e As EventArgs) Handles btnZipFiles.Click
Dim dir = SelectedPath.Text
Dim reqextensions As String = "*.dbf,*.prj,*.shp,*.shx"
Dim files = Directory.EnumerateFiles(dir, "*.*", SearchOption.AllDirectories)
For Each file In files
Using zip As New ZipFile
zip.AddFile(file, "")
zip.Save(file + ".zip")
End Using
Next
End Sub
I've added "dotnetzip" and Imported Ionic.zip. The above code will zip each .dbf, .prj, .shp, and .shx file individually, but I am stuck on how to combine each 4 files into one zip file.
Thank you in advance.