Avatar of zorba111
zorba111
 asked on

do FileSystemObject's methods require an absolute path?

I'm using FileSystemObject (instance is fso) in VBScript in an ASP page.

I've been using relative paths for some of the fso methods, e.g.

fso.FileExists("..\dir\file.txt")
same with fso.DeleteFile etc.

which doesn't seem to be working, nor when I specify a file in the same dir, like so

fso.FileExists("dummy.txt")

However when I supply a full path, the functions work

I've looked on MSDN at the documentation for FileSystemObject and there is NO INFORMATION about needing to use the absolute path.

Is this the case, or am I going mad ?
Or maybe I've missed the reference somehow, and if someone could point me at it, be most grateful.

cheers!
VB ScriptASP

Avatar of undefined
Last Comment
zorba111

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
zorba111

ASKER
@angelll

>> I presume, you expect the "current directory" to be the one of the ASP file, but alas, that is not so.

Another one of my assumptions carried over from the PHP paradigm, I think ;-)
Thanks for clarifying!
So the FSO objects CAN use virtual / relative paths, but to specify these we need the current directory, which would be a pain to work out - ergo, use absolute paths :-)

>> the current directory is one of the IIS web server processes ...

I presume that will be something c:\windows\system32\IIS or whatever ?

>> you need to use Server.MapPath:

familiar with it, and using it already as  a work around


thanks dude
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck