Tutorials References Menu

ASP Drive Property


❮ Complete File Object Reference

The Drive property is used to return the drive letter of the drive where the specified file or folder resides.


Syntax

FileObject.Drive

FolderObject.Drive

Example for the File object

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("File resides on drive: ")
Response.Write(f.Drive)
set f=nothing
set fs=nothing
%>

Output:

File resides on drive: c:

Example for the Folder object

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("Folder resides on drive: ")
Response.Write(fo.Drive)
set fo=nothing
set fs=nothing
%>

Output:

Folder resides on drive: c:

❮ Complete File Object Reference