SoFunction
Updated on 2025-04-13

The magical features of FSO in ASP - Introduction

Author: Gan Jiping;


Original source: http:///Issue/

In ASP, FSO means File System Object, which is a file system object.

The computer file system we are going to manipulate refers to being located on the web server. So, make sure you have the right permissions for this. Ideally, you can set up a web server on your own machine so that you can easily perform testing. If running on Windows, try Microsoft's free personal web server PWS.

FSO Model Objects
Drive Object: Drive object for accessing disks or network drives
FileSystemObject Object: File system object The file system for accessing the computer
Folder Object: Folder object All properties of a folder are used to access
TextStream Object: Text stream object for accessing file content

You can use the above objects to do anything on your computer, including sabotage activities;-( So, be careful with FSO. In a web environment, storing information is very important, such as user information, log files, etc. FSO provides a powerful and simple way to efficiently save data. In this article, we focus on FileSystemObject and TextStream objects.

FSO is powered by Microsoft and ASP is probably no longer available for non-Windows systems.

How to use FSO?

In order to use FSO to perform all work, first create an object, the code is like this:

< %
Set fso = ("")
% >

This creates FSO and assigns the variable fso, and then you can use familiar syntax to perform the operation of the file system [see Visual Basic documentation for more knowledge about object and object wizard programming]. Here we can use OR , these will be seen in the example below.

The FSO model is located in a script runtime DLL file provided by Microsoft, which is. You can reference this DLL file in any application, such as MS Access, Word. That is, it is not just limited to applying it in ASP.

Here is a brief list of FSO methods:

FSO method
CopyFile Copy one or more files to a new path
CreateTextFile Creates a file and returns a TextStream object
DeleteFile Delete a file
OpenTextFile Opens the file and returns the TextStream object for reading or appending

If you want to know the complete FSO methods and properties, please refer to Microsoft MSDN. Let’s see a few examples below.