Duran 0 Posted August 25, 2010 So I wanted to pass my path to file exist and magically says its not found even though its there o.O unless I am doing it wrong or if there is an easier way to find if a folder/file is there better by using a variable. Any help would be welcome. $Name = "Name" $Year = @YEAR $Month = @MON $Day = @MDAY $Drive = "C:\" $Path = $Drive & "Some\Folder\" & $Name & "\" & $Month & "-" & $Day & "-" & $Year If FileExists($Path) Then MsgBox(4096, "C:\ Dir ", "Exists") Else MsgBox(4096,"C:\ Dir" , "Does NOT exists") EndIf Share this post Link to post Share on other sites
omikron48 0 Posted August 25, 2010 Have you tried looking at the value of $Path and verifying whether it's the correct path or not? This may be just formatting issues. Share this post Link to post Share on other sites
Richard Robertson 187 Posted August 26, 2010 You don't have a file extension on your path. Share this post Link to post Share on other sites
Duran 0 Posted August 26, 2010 It is the right path used msgbox to make sure it was showing the right path. I thought fileExist also checks for folder existence as well? Is there a function or UDF I could use that would find a folder name instead of a file, its what I am looking for I would put it. If you try the example I put up it will show even though you set up the folders to be true it says its false o.O Share this post Link to post Share on other sites
kaotkbliss 146 Posted August 26, 2010 fileexists will either return a 1 or 0, so you need to $Name = "Name" $Year = @YEAR $Month = @MON $Day = @MDAY $Drive = "C:\" $Path = $Drive & "Some\Folder\" & $Name & "\" & $Month & "-" & $Day & "-" & $Year $check = FileExists($Path) If $check = 1 Then MsgBox(4096, "C:\ Dir ", "Exists") Else MsgBox(4096,"C:\ Dir" , "Does NOT exists") EndIf 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
Duran 0 Posted August 26, 2010 fileexists will either return a 1 or 0, so you need to $Name = "Name"$Year = @YEAR$Month = @MON$Day = @MDAY$Drive = "C:\"$Path = $Drive & "Some\Folder\" & $Name & "\" & $Month & "-" & $Day & "-" & $Year$check = FileExists($Path)If $check = 1 Then MsgBox(4096, "C:\ Dir ", "Exists")Else MsgBox(4096,"C:\ Dir" , "Does NOT exists")EndIfYeah figured that much when I read how to use the function. Thanks for the help though. Basically checking to see if the folder 8-26-2010 is there thats all its checking. Doesn't seem like the variable is formating it correctly and the function is getting confused. Your example does the exact same thing as what I posted as the function gets confused how to process the multi variable string it just passes a 0. Share this post Link to post Share on other sites
kaotkbliss 146 Posted August 26, 2010 oooh, I think MDAY might be returning 08 and if your folder is name 8 then it might not accept the match. 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
Duran 0 Posted August 26, 2010 oooh, I think MDAY might be returning 08 and if your folder is name 8 then it might not accept the match.That was it thanks my testing folders I made by hand and didn't put the 0. Good thing the script that makes the folders puts the 0 in >< Share this post Link to post Share on other sites