Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

VBScript FileSystemObject Object

The VBScript FileSystemObject object provides access to a computer's file system.

Methods: VBScript FileSystemObject Object

VBScript FileSystemObject Object BuildPath Method

Appends a name to an existing path.

VBScript FileSystemObject Object CopyFile Method

Copies one or more files from one location to another.

VBScript FileSystemObject Object CopyFolder Method

Recursively copies a folder from one location to another.

VBScript FileSystemObject Object CreateFolder Method

Creates a folder.

VBScript FileSystemObject Object CreateTextFile Method

Creates a specified file name and returns a TextStream object.

VBScript FileSystemObject Object DeleteFile Method

Deletes one or more files.

VBScript FileSystemObject Object DeleteFolder Method

Deletes a folder and its contents.

VBScript FileSystemObject Object DriveExists Method

Indicates the existence of a drive.

VBScript FileSystemObject Object FileExists Method

Indicates the existence of a file.

VBScript FileSystemObject Object FolderExists Method

Indicates the existence of a folder.

VBScript FileSystemObject Object GetAbsolutepathname Method

Returns a complete and unambiguous path from a provided path specification.

VBScript FileSystemObject Object GetBaseName Method

Returns the base name of a path.

VBScript FileSystemObject Object GetDrive Method

Returns a Drive object corresponding to the drive in a path. This method is not currently supported on UNIX.

VBScript FileSystemObject Object GetDriveName Method

Returns a string containing the name of the drive for a path.

VBScript FileSystemObject Object GetExtensionName Method

Returns a string containing the extension for the last component in a path.

VBScript FileSystemObject Object GetFile Method

Returns a File object corresponding to the file in a path.

VBScript FileSystemObject Object GetFileName Method

Returns the last component of a path that is not part of the drive specification.

VBScript FileSystemObject Object GetFolder Method

Returns a Folder object corresponding to the folder in a specified path.

VBScript FileSystemObject Object GetParentFolderName Method

Returns a string containing the name of the parent folder of the last component in a path.

VBScript FileSystemObject Object GetSpecialFolder Method

Returns the special folder requested.

VBScript FileSystemObject Object GetTempName Method

Returns a randomly generated temporary file or folder name.

VBScript FileSystemObject Object MoveFile Method

Moves one or more files from one location to another.

VBScript FileSystemObject Object MoveFolder Method

Moves one or more folders from one location to another.

VBScript FileSystemObject Object OpenTextFile Method

Opens a file and returns a TextStream object.

Note

Collections returned by FileSystemObject method calls reflect the state of the file system when the collection was created. Changes to the file system after creation are not reflected in the collection. If the file system might be changed during the lifetime of the collection object, the method returning the collection should be called again to ensure that the contents are current.

Properties: FileSystemObject Object

VBScript FileSystemObject Object Drives Property

A Drives collection of all Drive objects available on the local machine.

Syntax: FileSystemObject Object

Scripting.FileSystemObject

Remarks: FileSystemObject Object

The following code illustrates how FileSystemObject is used to return a TextStream object that can be read from or written to:

Set fs = CreateObject("Scripting.FileSystemObject")

Set a = fs.CreateTextFile("c:\testfile.txt", True)

a.WriteLine("This is a test.")

a.Close

In the code shown above, the CreateObject function returns the FileSystemObject (fs). The CreateTextFile method then creates the file as a TextStream object (a) and the VBScript TextStream Object WriteLine Method writes a line of text to the created text file. The VBScript TextStream Object Close Method flushes the buffer and closes the file.

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.