Jump to content

DirExists?


Recommended Posts

Hi.

I really wish there was a function like If DirExists("\\server\share$") then ....

Right now I can look for a FileExists or a dirgetsize = x then...but I need to know something about it first. Trying to build on fly more things.

Short of hooking into a dll or a windows call, is there an easy UDF for this? I have not seen one.

Any solutions appreciated.

sul

Link to comment
Share on other sites

Hi.

I really wish there was a function like If DirExists("\\server\share$") then ....

Right now I can look for a FileExists or a dirgetsize = x then...but I need to know something about it first. Trying to build on fly more things.

Short of hooking into a dll or a windows call, is there an easy UDF for this? I have not seen one.

Any solutions appreciated.

sul

<{POST_SNAPBACK}>

hm... check the help file again on the DirGetSize()... you may have missed:

Failure: Returns -1 and sets @error to 1 if the path doesn't exist.

***edit***

i had seperated the function name into 3 parts because i am Re Tar Ded

Edited by cameronsdad
Link to comment
Share on other sites

Why so it does. Thanx for pointing that out. I went the long way around and wrote error code for that, but did not think to use it as a positive thing.

2 sets of eyes are better than one on .chm's I think.

sul

<{POST_SNAPBACK}>

np, glad i could help, happens to everyone
Link to comment
Share on other sites

I wonder what the difference would be between:

1. DirGetSize( $sDir )

and

2. FileExists( $sDir ) And ( StringInStr( FileGetAttrib( $sDir ), "D" ) > 0 )

perhaps implemented as

3.

Func DirExists( $sDir )

Return ( FileExists( $sDir ) And ( StringInStr( FileGetAttrib( $sDir ), "D" ) > 0 ) )

EndFunc

I tend towards 3, as using

If DirExists( "\\Server\share$" ) Then ...

makes the intent of your code obvious.

hm... check the help file again on the DirGetSize()... you may have missed:

***edit***

i had seperated the function name into 3 parts because i am Re Tar Ded

<{POST_SNAPBACK}>

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...