When ASP is installed, the FileSystemObject is automatically installed along with it. The FileSystemObject allows you to work with drives, folders, and files on the server.
Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022


Working With Drives in ASP

When ASP is installed, the FileSystemObject is automatically installed along with it. The FileSystemObject allows you to work with drives, folders, and files on the server.

The FileSystemObject has a collection property called Drives. A collection is a list or array of objects of the same type. Each drive in the drives collection has a RootFolder object. Each Folder (including the RootFolder) has a subfolders collection and a Files collection.

Drives Collection

In certain instances, you may not be sure that a specific drive exists. In that case, you can use the DriveExists method of the FileSystemObject before attempting to access the drive. Example code for this is shown below.

<%
Dim objFS

Set objFS = _ 
  Server.CreateObject("Scripting.FileSystemObject")
If objFS.DriveExists("c:") = true then
  Response.Write("Drive Exists")
Else
  Response.Write("Drive Doesn't Exist")
End If
Set objFS = Nothing
%>

The drive that you are attempting to access might be a removable storage unit. In that case, you should check the Drive objects IsReady property to make sure the removable media is installed before attempting to access the drive. Example code for this is shown below.

<%
Dim objFS, Drv

Set objFS = _ 
  Server.CreateObject("Scripting.FileSystemObject")
Set Drv = objFS.GetDrive("c:")

If Drv.IsReady = True Then
  Response.Write("Drive Ready")
Else
  Response.Write("Drive Not Ready")
End If
Set Drv =  Nothing
Set objFS = Nothing
%>

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2017 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268