Sign in to follow this  
Followers 0
Kidney

Easy way to tell file type?

3 posts in this topic

Im trying to find out how to tell if a a _FileListToArray entry is a file or folder without using flag 2.

is there a function that checks the file type (or extention) of a file/folder??

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

From Example 3 for FileGetAttrib in the Help File.

; Check if the filepath is a directory/folder. Does not validate if the directory/folder exists.
Func IsDir($sFilePath)
    Return StringInStr(FileGetAttrib($sFilePath), "D") > 0
EndFunc   ;==>IsDir
Edited by saudumm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

 

From Example 3 for FileGetAttrib in the Help File.

; Check if the filepath is a directory/folder. Does not validate if the directory/folder exists.
Func IsDir($sFilePath)
    ;Return StringInStr(FileGetAttrib($sFilePath), "D") > 0
    Return StringInStr(FileGetAttrib($sFilePath), "D") ; removed the '> 0'
EndFunc   ;==>IsDir

 

I would add a line to check the output of FileGetAttrib() so you don't get a false positive/negative from StringInStr()

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0