Files are the building blocks of any application running under any OS. Files are also the software elements that administrators and users manipulate most of their workday. However, none of the Windows file systems (e.g., FAT, NTFS) follow an object-oriented schema. In other words, Windows file systems don't consider a file (or a folder) as an object with a fixed programming interface. To make Windows file systems recognize a file as an object, you need to use a tool such as the File System Object (FSO) model. With the FSO model's File object, you can manipulate files in VBScript applications.
The File object represents a file in a Windows file system. After you access the File object, you can use the object's methods and properties to work with it. The File object has 12 properties that provide information about files and four methods that manipulate files.
Accessing the File Object
To work with a File object, you need a reference to it. You can obtain this reference in two ways, both of which rely on the FileSystemObject object. First, you can call the FileSystemObject object's GetFile method and specify the fully qualified filename (i.e., the absolute or relative path) of the file you want to access. Second, you can enumerate the items in the FileSystemObject object's Files collection and stop at the element whose properties match your criteria. Let's examine the pros and cons of both techniques. . . .
gpalmer4177 July 18, 2004 (Article Rating: