FSO, as UFO is very exciting, God, of course, is more happy to worry. Jun does not see a space service provider advertisement: 100MB space as long as 60RMB / year, support database, what is supported ... I don't support FSO, and immediately. What is FSO is what is, how is its power? What is the principle of its operation? This time I have a thorough understanding.
First, FSO is a referred to as FileSystemObject. Of course, our commonly known as FSO component, which can be used to process drives, folders, and files.
It can detect and display the information allocation of the system drive; also can be created, changed, moved, and delete folders, and can detect if some given folders exist, if there is, the information of the folder can be extracted. Such as the date, the date created or the last revision, and so on. FSO also makes it easy for the processing of files.
First, fso.getdrive
As in the establishment of other components, the reference to the FSO must also establish a connection.
SET FSO = Server.createObject ("scripting.filesystemObject") Note The inside of CreateObject is not MSWC, but scripting. The driver can be processed by FSO below. For example, fso.getdriveName extract the drive name, fso.getdrive also extracts the standard drive name. such as:
1, fso.asp
<% Set fso = server.createObject ("scripting.filesystemObject")%> <% = fso.getdrivename ("D:")%>
<% = fso.getdrive ("D:")%> You will Discover GetDriveName ("D:") is "D:", and GetDrive ("D:") is a standard "D:", so we generally write fso.getdrive (fso.getdrivename (drvpath) to extract some A specific driver disk.
Second, Drv.getinfo has been extracted with a particular drive, and then the specific information of the drive disk is not extracted.
2, drv.asp
<% Set fso = server.createObject ("scripting.filesystemObject") set drv = fso.getdrive (fso.getdrivename ("D:"))%> The space size of the disk: <% = drv.totalsize%>
The remaining space size of the disc: <% = drv.freespace%> The above is just the information extracted D-disk drive, to a universal function, continue to test your own driver.
3, Drvinfo.asp
<% Function ShowdriveInfo (DRVPATH) DIM FSO, DRV, S set fso = createObject ("scripting.filesystemObject") SET DRV = fso.getdrive (fso.getdrivename (drvpath)) s = "Volume" & DRV & " The standard is: "s = s & drv.voluMename &"
"S = S &" total space: "& drv.totalsize &"
"S = S &" Remaining Space: "& Drv.Freespace &
"S = S &" file type: "& drv.drivetype"
"S = S &" file system: "& driLeSystem response.write send function%> <% on Error ResMe Nextwhatpath = Request.form ("Path") if whatpath <> "" "theshowdriveInfo (whatPath) end if%>