Dinakar Nethi

A .NET/SQL Server Blog

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567


Navigation

About Me

Links

Subscriptions

Article Categories



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

posted on Friday, June 11, 2004 2:58 PM by dinakar





Powered by Dot Net Junkies, by Telligent Systems