Cannot access remote PC root

the master
01-08-2008, 12:07 PM
Hi. If i tell VB to get a directory listing of "\\server01\" it says it cant. "Bad filename or number".

This is the line that causes a problem

s = Dir("\\server01\", vbDirectory)


It works fine on sub folders but not on the root folder. Is there a reason? Is there anything i can do about it? Windows can get a list of that same path just fine

AstroTux
01-08-2008, 12:37 PM
Hmmmmmmm..........

IIRC that won't work because the root isn't actually a folder per se.

Have you tried it without the trailing \ ?

s = Dir("\\server01", vbDirectory)

Best regards,
AstroTux.

the master
01-08-2008, 12:42 PM
Same result. Removing the trailing slash from any filepath causes other problems too

Cerian Knight
01-09-2008, 12:18 PM
The sharename must be appended to the servername to get at the shared root:

'to get shared root
s = Dir("\\Server01\ShareName\", vbDirectory)
'or to get at my directory
s = Dir("\\Server01\ShareName\MyDir", vbDirectory)

I tested this and it works for me.

the master
01-09-2008, 02:19 PM
I know that works but that does explain why the root doesnt work. The root isnt really a folder. Its a list of shared folders.

The question should be how do i get a list of shared folders from another computer?

Roger_Wgnr
01-09-2008, 02:24 PM
You would need to use the SHBrowseForFolder API. This allows you to list the Shared folders on a PC Name or IP.

the master
01-09-2008, 02:40 PM
Ill look into that thanx.

I think this app is gonna get very complicated very quick

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum