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 objects for accessing disks or network drives
FileSystemObject Object: File system objects for accessing the computer's file system
Folder Object: Folder object for accessing all properties of a folder
TextStream Object: Text stream object for accessing file content
You can use the above object to do anything on your computer, including sabotage activities;-( So, be careful with FSO. In a web environment, it is very important to store information, such as user information, log files, etc. FSO Provides a powerful and simple way to save data efficiently. 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 = Server.CreateObject(scripting.FileSystemObject)
% >
This creates FSO and assigns the variable fso. Then you can use the familiar object.method 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 fso.method or fso.property, which will be seen in the following example.
The FSO model is located in a script runtime DLL file provided by Microsoft, which is scrrun.dll. 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.