Pages

Sunday, January 30, 2011

Check for File Lock

 Private Function IsFileLocked(ByVal filePath As String) As Boolean

        Dim fs As FileStream = Nothing
        Dim result As Boolean = False
    
        Try
             File.Copy(filePath, POLL_PATH + "\Processing\" + temp(bound) + "~scanReport.csv")
             result = False
      
        Catch ex As Exception
            'file lock - still copying
            result = True
          
        End Try

        Return result

End Function

No comments:

Post a Comment