Example Code:
Create a file source code 1:
<% ' source code : allow overwrite
dim fso,newfile
set fso=Server.CreateObject("Scripting.FileSystemObject")
set newfile=fso.CreateTextFile("c:\mypath\newfile1.txt",true)
newfile.WriteLine "text here"
newfile.close
set newfile=nothing
set fso=nothing
%>
Check a file source code -------------
<%
if fso.fileExists ("c:\mypath\newfile1.txt") then
end if
set fso=nothing
%>
you may use
<%
Set AppendText = "(appent a text line after old file)"
Set fso = CreateObject("Scripting.FileSystemObject")
filename = server.mappath("c:\mypath\newfile1.txt")
Set appendfile = fso.OpenTextFile(filename,8,True)
appendfile.writeline(AppendText)
appendfile.close
Set appendfile = Nothing
Set fso = Nothing
%>
|