Date: 02-16-2022
Return to Index
created by gbSnippets
'Multiple ways to see if a file exists
If IsFile(fName$) Then
'file exists
End If
If IsFalse(IsFile(fName$)) Then
'file does not exist
End If
If Len(Dir$(fName$)) Then
'file exists
Else
'file does not exist
End If
If Dir$(fName$) <> "" Then
'file exists
Else
'file does not exist
End If
Function FileExists(ByVal fName As String) As Long
Function = (Len(Dir$(fName)) > 0)
End Function
Function FileExists(ByVal fName As String) As Long
Function = (Dir$(sFile) <> "")
End Function
Function zExist (ByVal fName As String) As Long
Local fd As Win32_Find_Data, hExist As Long
If Len(sFileSpec) Then
hExist = FindFirstFile(ByVal StrPtr(fName), fd)
If hExist <> -1 Then
Call FindClose(hExist)
Function = -1
End If
End If
End Function
Function FileExists(ByVal fName As String) As Long
Local n As Long
n = GetAttr(fName)
Function = (ErrClear = 0)
End Function
'gbs_00839
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm