I am using UUEncode.Decode
to decode a batch of UUEncoded files. Occasionally one of the UUEncoded files is corrupt, causing UUEncode.Decode
to terminate. I handle this with Try .. Catch .. End Try
, which successfully handles the failure to decode a particular UUEncoded file.
For the next step I need to delete the UUEncoded file. If the UUEncode.Decode
was successful then I can go on to delete the UUEncoded file, but if the UUEncode.Decode failed, causing a catch, then I cannot delete the file as it is still open.
Any idea how to close the file left open by UUEncode.Decode so that I can proceed to delete it?
Here is the code:
Try
strOutputFilename = UUEncode.Decode(lblWorkingPath.Text & strFilename & ".uu", lblWorkingPath.Text)
Catch ex As Exception
strOutputFilename = ""
End Try
File.Delete(lblWorkingPath.Text & strFilename & ".uu")