[RESOLVED] API Way to see if a path is folder or file?
hello,
i tried google'ing around but that didnt helped much, i am looking for some way to check if a location on widdows system is a file or directory,
i am working with some program that comes up with filename with no extension so i just wanted to know a way to find how to differentiate them as file or folder only api way .
regards
raj
Re: API Way to see if a path is folder or file?
Code:
Private Declare Function PathIsDirectory Lib "shlwapi.dll" Alias "PathIsDirectoryA" (ByVal sPath As String) As Long
Private Sub Command1_Click()
MsgBox CBool(PathIsDirectory("C:\Documents and Settings"))
End Sub
Re: API Way to see if a path is folder or file?
A non-API alternative.
Code:
Private Sub Command1_Click()
MsgBox IsDirectory("C:\PIS\") 'true
MsgBox IsDirectory("C:\PIS\Untitled.png") 'false
End Sub
Private Function IsDirectory(ByVal sFile As String) As Boolean
IsDirectory = (GetAttr(sFile) And vbDirectory) = vbDirectory
End Function
Re: API Way to see if a path is folder or file?