borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Public sub and Private Sub?)Next Topic (application that only allows x number of users) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Is there a way to tell if a folder exists on a server Solved Topic
Poster Message
mcorben
Level: Whizz Kid

Registered: 31-05-2005
Posts: 16

icon Is there a way to tell if a folder exists on a server

Is there a way to tell if a file or folder exists on a server that is NOT mapped.?

I am using this code and it works for a mapped drive:


Public Function FileExists(Fname As String) As Boolean

If Fname = "" Or Right(Fname, 1) = "\" Then
FileExists = False: Exit Function
End If

FileExists = (Dir(Fname) <> "")
End Function

07-03-2006 at 06:02 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon Re: Is there a way to tell if a folder exists on a server

I believe you can still use the \\hostname\sharedfoldername\ also.  

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

07-03-2006 at 09:22 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
mcorben
Level: Whizz Kid

Registered: 31-05-2005
Posts: 16
icon Re: Is there a way to tell if a folder exists on a server

The tests I have done show it does not work unless it is mapped.

08-03-2006 at 03:48 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: Is there a way to tell if a folder exists on a server

if you have administrator privileges you'll be able to check if a folder exists by using the default administration shares (c$, d$,...)

Private Sub Command1_Click()
    MsgBox (Dir("\\yourserver\c$\winnt\regedit.exe"))
End Sub


[Edited by admin on 08-03-2006 at 05:46 PM GMT]

____________________________
AndreaVB

08-03-2006 at 04:45 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon Re: Is there a way to tell if a folder exists on a server

I could be the \\ path works (without the $c, $d, etc) if you use the "FindFirstFile" api call instead...
like:
http://www.andreavb.com/forum/viewtopic.php?TopicID=1084&page=0#3345

just search the forum for the text in the ""'s if you want to see it.


____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

08-03-2006 at 11:49 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
mcorben
Level: Whizz Kid

Registered: 31-05-2005
Posts: 16
icon Re: Is there a way to tell if a folder exists on a server

Thanks to admin, his cods worked.

Private Sub Command1_Click()
    MsgBox (Dir("\\yourserver\c$\winnt\regedit.exe"))
End Sub

I can do a dir of the folder and as long as there are files in it, I can detect it.

09-03-2006 at 04:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Is there a way to tell if a folder exists on a server Solved Topic
Previous Topic (Public sub and Private Sub?)Next Topic (application that only allows x number of users) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder