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

FileSystemObject on Windows 2K

Status
Not open for further replies.

ChrisQuick

Programmer
Oct 4, 1999
144
US
I have the following code for reading a textfile line by line and replacing each double quote with two, and then writing the new line to a new file.

<%
Option Explicit
Response.Buffer = True
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.CacheControl = &quot;no-cache&quot;

Dim objFSO
Dim ObjTextFileToRead
Dim ObjTextFileToWrite
Dim strFilename
Dim strTextLine
Const fsoForReading = 1

strFilename = &quot;C:\Trash_Me\testin.txt&quot;
'Create an instance of the FileSystemObject object
Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
If objFSO.FileExists(strFilename) Then
On Error Resume Next
Set ObjTextFileToRead = objFSO.OpenTextFile(strFilename, fsoForReading)
If Err.Number <> 0 Then
Set ObjTextFileToRead = Nothing
Response.Write &quot;Error Reading File&quot;
Response.Write Err.Description
End If

Set ObjTextFileToWrite = objFSO.CreateTextFile(&quot;C:\Trash_Me\testout.txt&quot;)

While not ObjTextFileToRead.AtEndOfStream
strTextLine = ObjTextFileToRead.ReadLine
trTextLine = Replace(strTextLine, &quot;&quot;&quot;&quot;, &quot;&quot;&quot;&quot;&quot;&quot;)
ObjTextFileToWrite.WriteLine(&quot;WritePretty &quot;&quot; &quot; & strTextLine & &quot; &quot;&quot;&quot;)

WEnd

' Clean Up
ObjTextFileToRead.Close
Set ObjTextFileToRead = Nothing
ObjTextFileToWrite.Close
Set ObjTextFileToWrite = Nothing
Else
Response.Write &quot;File not found&quot;
End If
Set objFSO = Nothing
Response.Write &quot;Finished&quot;
%>


When I run the code, it just seems to hang and do absolutely nothing!!! No errors, no script timeouts, nothing.

I recently installed the latest patches for windows 2000, I am now wondering if that is to blame.

Any thoughts or suggestions? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
You need to find the exact line that's causing the problem.
Insert lots of Response.Write statements so you can follow it's execution.

My guess is, though, the IUSR_xxxx account doesn't have write permissions to the directory.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top