The File System Object in VB Script

The file system object is used to gain access to the computer's file system. All the files and folders operations are performed using this object. Before doing any file or folder operation we need to create an instance of file system object. This is done using the 'CreateObject' function. The following piece of code shows how to create a vbscript file system object.

Dim fsObject
Set fsObject = CreateObject("Scripting.FileSystemObject")

The vbscript file system object is used for Text files only. It cannot open binary files like pictures, movie files etc in binary mode. It identifies the End Of File using the length of the file or the End Of File character (ASCII Code 26). So while reading from a file, if it sees the character 26 it will say that the end of file is reached ('AtEndOfStream' will return 'True'), even though the end of the file is not reached. (In normal text files character 26 usually will not occur)

Powered by Bullraider.com