FSO Series SIX * * Sample code Detail Code 1

Source: Internet
Author: User
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"
&



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.