Introduction to ASP Programming (16): Operation of the FSO component drive

Source: Internet
Author: User
FSO, as exciting as the UFO, fascinating, of course, more people are happy to let people worry. You do not see a space service provider advertising: 100MB space as long as 60rmb/years, supporting the database, support what what ... A question does not support FSO, immediately discouraged. What is the FSO, and how great is its power, and how is the principle of its operation? Here's a thorough understanding.
First of all, FSO is the abbreviation of FileSystemObject. Of course, it is also known as the FSO component, which can be used to work with drives, folders, and files.
It detects and displays the information distribution of the system drives, and can create, change, move, and delete folders, detect if a given folder exists, and, if so, extract information about the folder, such as name, date created or last modified, and so on. The FSO also makes it easy to process files.
First, FSO. Getdrive
As with the creation of other components, the FSO reference must also establish a connection.
Set fso=server.createobject ("Scripting.FileSystemObject")

Note that the interior of the CreateObject is no longer MSWC, but scripting.
The following can be used to handle the drive through the FSO. Like the FSO. GetDriveName Extract drive name, FSO. Getdrive also extracts standard drive names. Like what:
1,fso.asp
<%set fso=server.createobject ("Scripting.FileSystemObject")%>
<%=fso. GetDriveName ("D:")%><br>
<%=fso. Getdrive ("D:")%>

You will find that GetDriveName ("D:") is "D:" and Getdrive ("D:") is the standard "D:", so we generally write the FSO. Getdrive (FSO. GetDriveName (Drvpath)) to extract a specific drive disk.
Second, DRV. GetInfo
A particular drive has been extracted, and then it is not the specific information that is extracted from the drive.
2,drv.asp
<%
Set fso=server.createobject ("Scripting.FileSystemObject")
Set Drv=fso. Getdrive (FSO. GetDriveName ("D:"))
%>
The space size of the disk: <%=drv. Totalsize%><br>
The remaining space size of the disk: <%=drv. Freespace%>

The above only extracts the information of the D disk drive, to a common function, continue to test their own driver.
3,drvinfo.asp
<%
Function Showdriveinfo (Drvpath)
Dim FSO, DRV, s
Set fso = CreateObject ("Scripting.FileSystemObject")
Set DRV = fso. Getdrive (FSO. GetDriveName (Drvpath))
The volume label of s = "Drive Disk" & DRV & "is:"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.