Open In App

ASP FileSystem.Drives Property

The FileSystem.Drives Property is used to return a read-only collection of all Drive objects that are present on the system. The individual drive elements can be lopped through to get their properties.

Syntax:



FileSystemObject.Drives

Example: The below code illustrates how to display all the drive letters present on the system.




<%
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Get all the drives on the system
set fo=fs.Drives
  
Response.write("The drives present are:")
for each x in fo
  'Print the name of all drives on system
  Response.write("<br> Drive: " & x.DriveLetter)
next
  
set fo=nothing
set fs=nothing
%>

Output:



The drives present are:
Drive: C
Drive: D
Drive: E
Drive: F
Article Tags :