[thelist] ASP FileSystemObject
Chris Marsh
chrism at puffofsmoke.net
Wed Jan 30 11:55:01 CST 2002
Dear all
I am trying to test for the existence of a text file on my server, and
creating it if it does not already exist using ASP. The code I am using is
posted below. With this code, my browser just seems to hang when I click on
the page in question if the file does not exist, otherwise it is fine. I am
running Win2kPro, IIS5. Any help would be much appreciated.
<%
Dim objFSO
Dim objTF
Dim strPath
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strPath = Server.MapPath(Application("strPath")) & "\news\docs\copy.txt"
'-- Check for existence of text document
If objFSO.FileExists(strPath) = false Then
Response.Write "Does Not Exist<br><br>" & strPath
'-- Create file
Set objTF = objFSO.CreateTextFile(strPath)
objTF.WriteIn "Hello World"
objTF.Close
Else
Response.Write "Does Exist<br><br>" & strPath
End If
%>
Regards
Chris Marsh
More information about the thelist
mailing list