VB.NET code to check if a file exists
Function
CheckIfFileExists(ByVal FolderPath, ByVal FileName) As Boolean
Dim objFSO
Dim objFolder, file
objFSO = CreateObject("Scripting.FileSystemObject")
objFolder = objFSO.GetFolder(FolderPath)
For Each file In objFolder.files
If LCase(file.name) = Trim(LCase(FileName)) Then
FileExists =
True
Else
FileExists =
False
End If
Next
objFSO =
Nothing
Return FileExists
End Function