<body>
<%
Set Fs=server.createobject ("Scripting.FileSystemObject")
if ( Fs.fileexists ("C:windowscursorsxxx.cur")) =true then
Response.Write ("File C:windowscursorsxxx.cur exists.
Else
Response.Write ("File c:windowscursorsxxx.cur does not exist.") ")
End If
Set fs=nothing
%>
</body>
<body>
;%
Set Fs=server.createobject ("Scripting.FileSystemObject")
If Fs.folderexists ("c:emp") = True Then
Response.Write ("folder C:emp exists.")
Else
Response.Write ("folder C:emp does not exist.") ")
End If
Set fs=nothing
%>
</body>
<body>
<%
Set Fs=server.createobject ("Scripting.FileSystemObject")
If Fs.driveexists ("c:") = True Then
Response.Write ("drive C: exists.") ")
Else
Response.Write ("drive C: does not exist.") ")
End If
Response.Write ("<br>")
If Fs.driveexists ("G:") = True Then
Response.Write ("Drive G: exists.") ")
Else
Response.Write ("Drive G: does not exist.") ")
End If
Set fs=nothing
%>
</body>
Because the FSO object is contained in the Scripting type library (Scrrun.dll), you first need to refer to the file in the project before you use it, click Project, Reference, and then select Microsoft Scripting Runtime in the Reference dialog box check box, and then click OK.
There are two ways to create an FSO object, one of which is to declare a variable as the FSO object type: Dim fsotest As New FileSystemObject, and the other is to create an FSO object through the CreateObject method: Set fsotest = CreateObject ("Scripting.FileSystemObject"). The actual use of the specific declaration method, according to the use of personal habits.
After the FSO object model is created, it is possible to access the properties of the subordinate objects by using the methods created by the object model to obtain the required information or to perform related operations, and the specific methods are described below