The FileSystemObject has a collection property called Drives. Each drive in the drives collection has a RootFolder object. Each Folder (including the RootFolder) has a subfolders collection and a Files collection.
Welcome to Bucaro TecHelp!

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

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Get The Hottest Natural Health Newsletters Free!

Natural Health Newsletters Free!

[ ] Alternative Medicine
[ ] Anti-Aging
[ ] Aromatherapy
[ ] Back pain Relief
[ ] Herbal Remedies
[ ] Magnetic Therapy
[ ] Natural Nutrition
[ ] Vitamin Research
[ ] Weight Loss

Click here to see all of our newsletters, and sign up for the ones you want!

Join American Consumer Opinion™ and Get Paid Cash!
Get paid $4 to $25 for each survey
Typically $4 to $25 for each survey.
Click Here to join (Available worldwide)

Working With Folders in ASP

When ASP is installed, the FileSystemObject is automatically installed 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 should 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
%>

Programming Sections
ASP

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269