Wednesday, February 16, 2011

what is ASP FileSystemObject?

The FileSystemObject object is used to access the file system on a server.
This object can manipulate files, folders, and directory paths. It is also possible to retrieve file system information with this object.
The following code creates a text file (c:\test.txt) and then writes some text to the file:

dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.txt",true)
fname.WriteLine("Hello World!")
set fname=nothing
set fs=nothing