Discussion:
Object doesn't support this property or method: 'fso.GetFile'
(too old to reply)
attitude rb
2004-08-04 15:34:14 UTC
Permalink
Okay, I give. I've been searching everywhere for help on this error and
nothing has worked. I'm trying to do something very simple using the
FileSystemObject and it won't work. All I want to do is read the files
and folders on my system using the following code in vbscript:

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f1d = fso.GetFile("C:\Downloads\test.txt")
Response.Write(fld.Path)

When it gets to the line using the "GetFile" or the "GetFolder" methods
it throws this error:

Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'GetFile'

However when I use either of the following, they do work:

fln = fso.GetFileName("C:\Downloads\test.txt")
Response.Write(fln & "<br>")

or,

If fso.FolderExists("C:\Downloads") then
Response.Write("There is a folder named \Downloads")
End if


Does anyone know what could be preventing this from working?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Andrey P
2004-08-04 20:54:56 UTC
Permalink
Post by attitude rb
Set f1d = fso.GetFile("C:\Downloads\test.txt")
Set fld = fso.GetFile("C:\Downloads\test.txt")

Give it a try.

-Andrey
Post by attitude rb
Okay, I give. I've been searching everywhere for help on this error and
nothing has worked. I'm trying to do something very simple using the
FileSystemObject and it won't work. All I want to do is read the files
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f1d = fso.GetFile("C:\Downloads\test.txt")
Response.Write(fld.Path)
When it gets to the line using the "GetFile" or the "GetFolder" methods
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'GetFile'
fln = fso.GetFileName("C:\Downloads\test.txt")
Response.Write(fln & "<br>")
or,
If fso.FolderExists("C:\Downloads") then
Response.Write("There is a folder named \Downloads")
End if
Does anyone know what could be preventing this from working?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
gadya
2004-08-23 14:39:01 UTC
Permalink
You sorted him out, now me!

I am learning to use ASP on IIS 6 under Windows XP.
When I came to the FileSystemObject I found IIS hangs on OpenTextFile.
(no problem when scripting on the Client!)
I couldn't find anything on Technet so looked in an IIS group and found your
contribution.

I find that I can use folderExists
but not getFolder

I can use GetFileName
but not GetFile
and not OpenTextFile

(I've tried using Fat32 and NTFS and different drive letters but to no avail.
I've turned off Norton antivirus and set my IE security settings to Low.)

I'm using the Script Debugger and executing one command at a time and it
hangs consistently on binding to a file.
I then have to reboot my PC in order to be able to use IIS.
------------------------

This works:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Stop
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists("H:\Downloads") then
Response.Write("<br>There is a folder named \Downloads")
End if

fln = fso.GetFileName("H:\Downloads\test.txt")
Response.Write(fln & "<br>")

</SCRIPT>

(The Stop is to activate the Debugger)
---------------------------------------

These don't work
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Stop
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists("H:\Downloads") then
Response.Write("<br>There is a folder named \Downloads")
set objFolder = fso.getFolder ("H:\Downloads")
' fails here
Response.Write("<br>Have bound to folder named \Downloads")
End if
</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Stop
Set fso = Server.CreateObject("Scripting.FileSystemObject")

fln = fso.GetFileName("H:\Downloads\test.txt")
Response.Write(fln & "<br>")

set objFile = fso.GetFile ("H:\Downloads\test.txt")

' fails here
Response.Write("<br>Have bound to file named test.txt")

</SCRIPT>
--------------------------------

Any ideas?
Post by Andrey P
Post by attitude rb
Set f1d = fso.GetFile("C:\Downloads\test.txt")
Set fld = fso.GetFile("C:\Downloads\test.txt")
Give it a try.
-Andrey
Post by attitude rb
Okay, I give. I've been searching everywhere for help on this error and
nothing has worked. I'm trying to do something very simple using the
FileSystemObject and it won't work. All I want to do is read the files
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f1d = fso.GetFile("C:\Downloads\test.txt")
Response.Write(fld.Path)
When it gets to the line using the "GetFile" or the "GetFolder" methods
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'GetFile'
fln = fso.GetFileName("C:\Downloads\test.txt")
Response.Write(fln & "<br>")
or,
If fso.FolderExists("C:\Downloads") then
Response.Write("There is a folder named \Downloads")
End if
Does anyone know what could be preventing this from working?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Loading...