Sign in to follow this  
Followers 0
Duran

File Exist issue

8 posts in this topic

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



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

You don't have a file extension on your path.

Share this post


Link to post
Share on other sites

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

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


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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

Yeah 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

oooh, I think MDAY might be returning 08 and if your folder is name 8 then it might not accept the match.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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

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