|
Display all available drives
This example will display all available drives
on your system and displays various other information about
free space , the total size and the file system .
Code:
<%
'declare our variables
Dim objFSO , objDrive , drive
'create an instance of FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objDrive = objFSO.Drives
'loop through every drive that is present
For Each drive in objDrive
'if the drive is ready then execute the following
If drive.IsReady Then
Response.Write drive.DriveLetter & "<br>"
Response.Write drive.Path & "<br>"
Response.Write drive.FileSystem & "<br>"
Response.Write drive.TotalSize & "<br>"
Response.Write drive.FreeSpace & "<br>"
'if the drive is not ready execute the following
Else
Response.Write drive.DriveLetter & "<br>"
Response.Write "is unavailable"
End If
Next
destroy objects
Set objDrive = Nothing
Set objFSO = Nothing
%>
|