fso| example ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' "" "" "" "" "" "" "" "" "" "" "" ""
'
' Showdrivetype
'
Objective
'
' Generates a string that describes the drive type of the given Drive object.
'
' Demonstrate the content below
'
'-Drive.drivetype
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function Showdrivetype (Drive)
Dim S
Select Case Drive.drivetype
Case Drivetyperemovable
S = "Removable"
Case Drivetypefixed
S = "Fixed"
Case Drivetypenetwork
S = "Network"
Case Drivetypecdrom
S = "CD-ROM"
Case Drivetyperamdisk
S = "RAM Disk"
Case Else
S = "Unknown"
End Select
Showdrivetype = S
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Showfileattr
'
Objective
'
' Generates a string that describes the properties of a file or folder.
'
' Demonstrate the content below
'
'-file.attributes
'-folder.attributes
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function showfileattr (file) can be a file or folder
Dim S
Dim Attr
Attr = File.attributes
If Attr = 0 Then
showfileattr = "Normal"
Exit Function
End If
If Attr and fileattrdirectory Then s = S & "Directory"
If Attr and fileattrreadonly Then s = S & "Read-only"
If Attr and Fileattrhidden Then s = S & "Hidden"
If Attr and Fileattrsystem Then s = S & "System"
If Attr and Fileattrvolume Then s = S & "Volume"
If Attr and fileattrarchive Then s = S & "Archive"
If Attr and Fileattralias Then s = S & "Alias"
If Attr and fileattrcompressed Then s = S & "Compressed"
Showfileattr = S
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Generatedriveinformation
'
Objective
'
' Generates a string that describes the current state of the available drives.
'
' Demonstrate the content below
'
'-filesystemobject.drives
'-Iterating the Drives collection
'-Drives.count
'-Drive.availablespace
'-Drive.driveletter
'-Drive.drivetype
'-Drive.filesystem
'-Drive.freespace
'-Drive.isready
'-Drive.path
'-Drive.serialnumber
'-Drive.sharename
'-drive.totalsize
'-Drive.volumename
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function generatedriveinformation (FSO)
Dim Drives
Dim Drive
Dim S
Set drives = FSO. Drives
S = "Number of drives:" & TabStop & Drives.count & newline & newline
' Constructs the first line of the report.
s = S & String (2, TabStop) & "Drive"
s = S & String (3, TabStop) & "File"
s = S & TabStop & "Total"
s = S & TabStop & "Free"
s = S & TabStop & "Available"
s = S & TabStop & "Serial" & NewLine
' Constructs the second line of the report.
s = S & "Letter"
&