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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

path not found accessing FileSystemObject with UNC

Status
Not open for further replies.

ryan101

Programmer
Jul 11, 2001
13
US
I'm having trouble accessing a file with the Scripting.FileSystemObject.

The following works great:
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set folder = fs.GetFolder("E:\webfiles\directory")

However, when I try to use the UNC, I get a path not found error. For instance:
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set folder = fs.GetFolder("\\webserver\webfiles\directory")

This gives "path not found". The directory is a hidden directory, and I've tried putting the $ at the end as well. It gives me the same error.

I can access \\webserver\webfiles\directory$ from the run line, and have verified that when the asp page modifies the E:\webfiles\directory it is modifying the \\webserver\webfiles\directory$, so there doesn't seem to be a problem with an incorrect mapping.

Any help would be appreciated.
 
U cannot acess a network path with FileSystemObject, but u could Map this path to an drive and then use it with the FSO object.
Here is an example:
Code:
set wn=CreateObject("WScript.Network.1")
wn.MapNetworkDrive "i:","\\adrian\c"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile "c:\boot.a","i:\"
wn.RemoveNetworkDrive "i:"
________
George, M
 
RYAN101 Wrote:
> The following works great:
> Set fs = Server.CreateObject("Scripting.FileSystemObject")
> Set folder = fs.GetFolder("E:\webfiles\directory")

So why not use it? :-0

Just kidding! You might consider the server.mappath if you are not sure of changing drive letters, higher directory structures, etc.

try this:

thefilepath = Server.MapPath("/directory\")
Set folder = fs.GetFolder(thefilepath)

hope it helps! It's how I do it! =====================
Dennis B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top