I'm trying to delete a bunch of files, but some of them are locked (in use). I simply want to program to just skip over the locked ones and keep going, but the OS (Windows7) pops up a message each time it tries to delete one of these files and tells me it is in use. I just want to suppress the error and leave the file there and keep trying to delete the others.
My only options for "FileIO.UIOption" is "All" or "Errors Only", I want "None".
For Each foundFile As String In My.Computer.FileSystem.GetFiles(Application.StartupPath, FileIO.SearchOption.SearchTopLevelOnly, "*.old")
Try
My.Computer.FileSystem.DeleteFile(foundFile, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
Catch ex As Exception
End Try
Next
Solved - See below