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\fil e.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!
I've been using relative paths for some of the fso methods, e.g.
fso.FileExists("..\dir\fil
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>> 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