Drive Function:

The Drive Function checks a drive for existence and then checks it's readiness. There is one required argument, drivespec which must be a letter representing a drive (A-Z) on the server.

The Drive function returns the letter of the drive if it exists and is ready. If the drive exists but is not ready, Drive returns Null. If the drive does not exist, Drive returns Empty.

Syntax:
string = Drive(drivespec)
Example Usage:
Return a list of all existing and ready drives on the server using the Drive function.
<%
Call PrintDriveLists()

Private Sub PrintDriveLists()
	Dim i, a, drv, readydrives
	Dim availablebutnotready

	readydrives = ""
	availablebutnotready = ""
	for i = 65 to 90	 ' A - Z
		drv = chr(i)
		a = Drive(drv)
		If IsNull(a) Then
			availablebutnotready = _
			availablebutnotready & _
			drv & ", "
		ElseIf IsEmpty(a) Then
		Else
			readydrives = _
			readydrives & _
			a & ", "	
		End If
	next
	Response.Write "Ready Drives:<BR>"
	Response.Write readydrives & "<BR><BR>"
	Response.Write "Available Drives That Are Not Ready:<BR>"
	Response.Write availablebutnotready & "<BR><BR>"
End Sub
%>
ASP Source Code:
<%
Private Function Drive(byVal driveSpec)
	Dim objFSO, boolFound, objDrive
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	boolFound = objFSO.DriveExists(driveSpec)
	if boolFound then
		Set objDrive = objFSO.GetDrive(driveSpec)
		if objDrive.IsReady Then
			Drive = objDrive.DriveLetter
		else
			Drive = Null
		end if
		Set objDrive = Nothing
	else
		Drive = Empty
	End If
	Set objFSO = Nothing
End Function
%>