Write to a file with ASP and FSO
|Top Tutorials||New Tutorials||Submit||Login||Register|
Total Hits: 10330
Total Votes: 139 votes
Category: ASP/File Manipulation
Submitted on: 2008-03-06 10:40:51
Submitted By: Devesh Khanna
Description:This is the code for APPENDING to a text file. This means what is already in the file will NOT be overwritten.
Dim Stuff, myFSO, WriteStuff
'this is what we will write in the file
Stuff = "Here is some stuff to write in the file."
'this line creates an instance of the File Scripting Object named myFSO
Set myFSO = CreateObject("Scripting.FileSystemObject")
'this line opens the file, notice the 8, it will cause the script to append to the file
Set WriteStuff = myFSO.OpenTextFile("C:\Inetpub\wwwroot\myNewFolder\myNewText.txt", 8, True)
'this line actually writes STUFF from above to the file
''this line closes the file
'this line destroys the instance of the File Scripting Object named WriteStuff
SET WriteStuff = NOTHING
'this line destroys the instance of the File Scripting Object named myFSO
SET myFSO = NOTHING
%> More detail...