Andy Green
asked on
vb.net checking if file exists problem
The following code in a windows service alway returns false:
Dim f As New IO.FileInfo(sourceFolder)
If f.Exists = 1 Then
LogError("FILE EXISTS " & f.FullName)
Else
LogError("FILE DOES NOT EXIST " & f.FullName)
End If
This is the value of f - - C:\FileExchange\Appointmen ts\Pending
And it contains the file -- Text Document.txt
I won't always know the name of the text file, and there may be 1 or more. I need to check that there are files in the folder before I process them.
What wrong?
Andy
Dim f As New IO.FileInfo(sourceFolder)
If f.Exists = 1 Then
LogError("FILE EXISTS " & f.FullName)
Else
LogError("FILE DOES NOT EXIST " & f.FullName)
End If
This is the value of f - - C:\FileExchange\Appointmen
And it contains the file -- Text Document.txt
I won't always know the name of the text file, and there may be 1 or more. I need to check that there are files in the folder before I process them.
What wrong?
Andy
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks All
Andy
Andy
If you want to check for the existence of a file then you need to pass the path AND name of the file.