Skip to content
Related Articles

Related Articles

ASP FileSystem.Drives Property

Improve Article
Save Article
Like Article
  • Last Updated : 22 Mar, 2021

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!