AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to check if a directory EXISTS ?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Wed Dec 02, 2009 10:15 am    Post subject: How to check if a directory EXISTS ? Reply with quote

How can make a function to check IF a directory exists... THEN... ?
Back to top
Guest






PostPosted: Wed Dec 02, 2009 10:19 am    Post subject: Re: How to check if a directory EXISTS ? Reply with quote

WOW, um, maybe IfExist? or...

Code:
if (FileExist("dir")) {
   msgbox, then???
}
Back to top
Icarus



Joined: 24 Nov 2005
Posts: 851

PostPosted: Wed Dec 02, 2009 1:34 pm    Post subject: Reply with quote

The above will of course work, but will also give true if there is a file with that name.

If you need to be sure that it is a directory, you can do something like this:
Code:
If( InStr( FileExist("Dirname"), "D") )
   msgbox Directory exists

_________________
Sector-Seven - Freeware tools built with AutoHotkey
Back to top
View user's profile Send private message Visit poster's website
Newb2AHK
Guest





PostPosted: Wed Dec 02, 2009 2:02 pm    Post subject: Why not Reply with quote

This is something i use everyday:

Code:
IfNotExist, %CLogDir%
   FileCreateDir, %LogDir%
Back to top
Guest






PostPosted: Wed Dec 02, 2009 7:00 pm    Post subject: Reply with quote

thanks to everyone
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group