Open In App

ASP FileSystem.Drives Property

Improve
Improve
Like Article
Like
Save
Share
Report

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.

ASP




<%
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

Last Updated : 22 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads