FileSystemObject Basics

 

The FileSystemObject (FSO) object allows you to use the familiar object.method syntax with a rich set of properties, methods, and events to process folders and files.

When To Use

Use the FileSystemObject with:

  • HTML to create Web pages

  • Windows Scripting Host to create batch files for Microsoft Windows

  • Script Control to provide a scripting capability to applications developed in other languages

Because using the FSO on the client side may provide potentially unwelcome access to a client's local file system, you should use it only in scripts executed on the server side. Internet Explorer default security settings do not allow client-side use of the FileSystemObject object. Overriding those defaults could subject a local computer to unwelcome access to the file system, which could result in total destruction of the file system's integrity, causing loss of data, or worse.

The FSO object gives your server-side applications the ability to create, find, alter, move, and delete files and folders. You can also find out information about files and folders, such as their names and the date they were created or last modified. The FSO object also makes it easy to process files. You can insert and change the data and output the data.

The FSO object model, which is contained in the Scripting type library (Scrrun.dll), supports text file creation and manipulation through the TextStream object.

See Also

Programming the FileSystemObject
FileSystemObject Reference (Windows Scripting)