Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript access a directory with underscore in it

Status
Not open for further replies.

cmbmick

Technical User
Nov 27, 2014
1
GB
Hi

Hope this is in the right place.

Fairly new to VB script. I am attempting to write a basic VBScript to count the files in a directory.

No problem So far I have this which works on standard directories:

Set fso = CreateObject("Scripting.FileSystemObject")

targetDir = "\\dir1\dir2\inter\pack\"

fileCount = fso.GetFolder(targetDir).Files.Count

However I have came across a Directory with an underscore in it which has stopped things working.

The path which does not work is : z:\Store\Interface\Tel_NG

Reading up I have discovered the underscore is used to split lines of code.

How do i Escape (or do i need to ) the underscore character?



Thanks in advance

Mike
 
It has nothing to do with an UNDERSCORE character, in my opinion.

Do you have your Z drive mapped to the server that contains those folders?

I'd rather use the server and path rather than a drive!
 
Did you want to post in forum329?

This is VBA. Has some commonality with VB Script. Are you coding in an application like Excel, Access or Word?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top