This project is read-only.

move files in a zip file

Jan 13, 2011 at 3:36 PM
Edited Jan 13, 2011 at 4:04 PM


I'm wondering if it is possible to move directly files in a zip files without  deleting them after.

I create a zip file


Using zip As ZipFile = New ZipFile
zip.AddSelectedFiles("*.mo", "d:\work", "")


End Using


but in folder \work all files with extension *.mo are still present. I tried to find something in all discussions without success.

How can I do?

thanks in advanced



Jan 16, 2011 at 2:52 PM

Mi dispiace, there is no "Move" verb in the ZipFile class.  The metaphor or "object model" for the ZipFile class calls for applications to "Add entries" or "Add files" or "Add directories" into the ZipFile. 

There is a FileSelector class that may help you.  Rather than calling AddSelectedFiles, you can use the FileSelector to directly select files.  With that selection of files, you can then perform 2 actions:  add the files into the zip, then later delete the files if appropriate. It would look something like this:

Dim selector as New Ionic.FileSelector("*.mo")
Dim selection as New List<Of String>
selection = selector.SelectFiles("d:\work")
Using zip As ZipFile = New ZipFile
End Using
'' Delete files in the selection here