Jump to content
Sign in to follow this  
mik

How to differentiate a folder and a file?

Recommended Posts

In windows explorer, many files and folders may be under the same folder, and with controllistview method, we can get many things of these files and folders. But How to differentiate a file and a folder? Does autoit provide some methods?

thank you!

Share this post


Link to post
Share on other sites

@all

Using this :

$objFSO = ObjCreate("Scripting.FileSystemObject")
$objFolder = $objFSO.GetFolder("C:\Windows\System32")

Consolewrite ( "Type " & $objFolder.Type & @CRLF )

If it returns a Type it is a Folder otherwise it is a File.

regards

ptrex


Share this post


Link to post
Share on other sites

how about this trick:

you have a folder c:\temp

in it you have files. you can use fileexists() to determine if a file exists

you always have the NUL File in every folder,

meaning that if you would want to verify if a folder exists, you can check for this file:

if fileexists("c:\temp\NUL") then ..

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  

×
×
  • Create New...