Board index » Visual Studio » Underscore on folder name causing problem

Underscore on folder name causing problem

Visual Studio337
When I execute the following code nothing happens, even though I have

verified that there are subfolders under the "_Department Q Drives"

folder. The other two sPath work ok, showing me the subfolders. If I

change the "_Department Q Drives" to say "_Department XX Drives" I get

folder not found which is correct. I am not allowed to change the

folder name. Is there a work around to this problem so that I can

display subfolders?



Dim sPath



Set FSO = CreateObject("Scripting.FileSystemObject")



sPath = "\\netapp\MAIN$\_Department Q Drives" ' no error but nothing

is displayed



'sPath = "\\netapp\MAIN$\__Temp" ' [2 underscores] works OK

'sPath = "\\netapp\MAIN$\Activity Log" ' works ok



ShowSubfolders FSO.GetFolder(sPath)



Sub ShowSubFolders(Folder)



For Each Subfolder in Folder.SubFolders

Wscript.Echo Subfolder.Path

ShowSubFolders Subfolder

Next



End Sub


-
 

Re:Underscore on folder name causing problem

Does it help to have a trailing backslash in sPath?



--

Richard Mueller

Microsoft MVP Scripting and ADSI

Hilltop Lab - www.rlmueller.net">www.rlmueller.net

--



"Ronster" <rconners@keenan.com>wrote in message

Quote
When I execute the following code nothing happens, even though I have

verified that there are subfolders under the "_Department Q Drives"

folder. The other two sPath work ok, showing me the subfolders. If I

change the "_Department Q Drives" to say "_Department XX Drives" I get

folder not found which is correct. I am not allowed to change the

folder name. Is there a work around to this problem so that I can

display subfolders?



Dim sPath



Set FSO = CreateObject("Scripting.FileSystemObject")



sPath = "\\netapp\MAIN$\_Department Q Drives" ' no error but nothing

is displayed



'sPath = "\\netapp\MAIN$\__Temp" ' [2 underscores] works OK

'sPath = "\\netapp\MAIN$\Activity Log" ' works ok



ShowSubfolders FSO.GetFolder(sPath)



Sub ShowSubFolders(Folder)



For Each Subfolder in Folder.SubFolders

Wscript.Echo Subfolder.Path

ShowSubFolders Subfolder

Next



End Sub







-

Re:Underscore on folder name causing problem

On Mar 23, 12:58 pm, "Richard Mueller [MVP]" <rlmueller-

nos...@ameritech.nospam.net>wrote:

Quote
Does it help to have a trailing backslash in sPath?



--

Richard Mueller

Microsoft MVP Scripting and ADSI

Hilltop Lab -www.rlmueller.net">www.rlmueller.net

--



"Ronster" <rconn...@keenan.com>wrote in message



news:1174672052.177144.111410@o5g2000hsb.googlegroups.com...







>When I execute the following code nothing happens, even though I have

>verified that there are subfolders under the "_Department Q Drives"

>folder. The other two sPath work ok, showing me the subfolders. If I

>change the "_Department Q Drives" to say "_Department XX Drives" I get

>folder not found which is correct. I am not allowed to change the

>folder name. Is there a work around to this problem so that I can

>display subfolders?



>Dim sPath



>Set FSO = CreateObject("Scripting.FileSystemObject")



>sPath = "\\netapp\MAIN$\_Department Q Drives" ' no error but nothing

>is displayed



>'sPath = "\\netapp\MAIN$\__Temp" ' [2 underscores] works OK

>'sPath = "\\netapp\MAIN$\Activity Log" ' works ok



>ShowSubfolders FSO.GetFolder(sPath)



>Sub ShowSubFolders(Folder)



>For Each Subfolder in Folder.SubFolders

>Wscript.Echo Subfolder.Path

>ShowSubFolders Subfolder

>Next



>End Sub- Hide quoted text -



- Show quoted text -



I found out what the problem was, sort of. What I thought were

folders under the "_Department Q Drives" turned out to be shortcuts or

links to other servers so when I used the server name I really wanted

to go to, it worked fine. I just looked in Properties to see the

correct network path I needed. Thanks for the help anyway. It was a

real mystery for awhile.





-