ZipErrorAction.Skip doesn`t work for me

Dec 14, 2010 at 9:38 AM


I try to code an app for back up my files.

I have a checked Listbox item where i add or remove files that i want to zip practically it contains the paths to my files.

Let`s say that a file is missing on my hdd but it still has the path in checked ListBox and when zip sub is called it give me an error : "The file or directory does not exist !"

I tried to use zip.ZipErrorAction = ZipErrorAction.Skip to skip the missing files but it keeps to return the same error.

My code looks like :

Imports Ionic.Zip
Module subrutine
Public Sub zip()
        Call stergeZip()
            If index.listaFisiere.Items.Count <> 0 Then
                Using zip As ZipFile = New ZipFile()
zip.ZipErrorAction = ZipErrorAction.Skip

                    For Each item In index.listaFisiere.Items
                End Using
                If My.Settings.FTPPornit = True Then Call ftp()
                If My.Settings.HDDPornit = True Then Call hdd()
                If My.Settings.mailPornit = True Then Call mail()
                With index.balon
                    .BalloonTipText = "Back up efectuat cu succes !"
                    .BalloonTipIcon = ToolTipIcon.Info
                End With
                MsgBox("Lista fisiserelor nu contine niciun obiect")
            End If
        Catch Ex As Exception
            With index.balon
                .BalloonTipText = "Back up esuat !"
                .BalloonTipIcon = ToolTipIcon.Error
            End With
        End Try
    End Sub
End Module

Dec 17, 2010 at 6:00 PM

Hmm, that's an interesting case.  I'll file a bug and fix that, some way.

In the meantime you can avoid the problem completely by inserting a test for file existence before calling Zip.AddItem(). 

like this:

If (System.IO.File.Exists(item)) Then
End If
Dec 17, 2010 at 6:02 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 21, 2010 at 5:56 PM

Thank you. With your code mine program does what it should. Thank you again.