|
-
Jun 9th, 2011, 11:08 PM
#1
Thread Starter
Lively Member
[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
-
Jun 10th, 2011, 12:56 AM
#2
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
-
Jun 10th, 2011, 03:15 AM
#3
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
-
Jun 13th, 2011, 11:39 AM
#4
Thread Starter
Lively Member
Re: API Way to see if a path is folder or file?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|