O'Reilly logo

Windows XP in a Nutshell, Second Edition by Troy Mott, Tim O'Reilly, David A. Karp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

FileSystem Object

The default WSH scripting languages (VBScript and JScript) do not have any native file manipulation capabilities. This functionality is provided by the COM object FileSystem.

The FileSystem object (FSO) exposes a number of separate objects that provide the ability to perform file-related operations. Table 9-18 lists the objects exposed by the FileSystem component

Table 9-18. FileSystem objects

Object

Description

Folders

A collection that contains a list of folders for a specified folder

Folder

Exposes folder information such as size, attributes, and date information and methods to move, delete, and copy

Files

A collection that contains a list of files for a specified folder

File

Exposes file information such as size, attributes, and date information and methods to move, delete, and copy

Drives

Collection object that contains a list of available drives on the local machine

Drive

Exposes drive information, such as size and type

TextStream

Provides text file manipulation

The FSO exposes methods and properties that perform file manipulation operations. Before you can reference any of the objects listed in Table 9-18, you must create an instance of the FSO object:

'create an instance of an FSO object
Set objFSO = CreateObject("Scripting.FileSystemObject")

The FSO object exposes a number of file manipulation methods and properties. The following commands are a few of the most useful FSO-related methods and properties. See “Additional Resources,” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required