DriveInfo

(Engine-Level Function)

Description: Returns information about a disk drive.
Returns: Pointer  (see comments)
Usage: Script Only.
Function Groups: Software and Hardware
Related to: Dir | FileFind
Format: DriveInfo(Attributes, Option)
Parameters:  
Attributes   

Required. Any numeric expression which gives the attributes to match for each drive. Drives that don't match these attributes won't be listed. The Attributes parameter is constructed by adding together the numbers from the table below

(See: Bitwise Parameters & Operations)

Attribute

Bit No.

Drive Type

1

0

Removable drive (floppy disk)

2

1

Fixed drive (hard disk)

4

2

Remote drive (network disk)

8

3

CD-ROM drive

Option   
Required. Any numeric expression giving the type of text information to generate. All information is placed in a single text string (which will be stored in an element of the array that is created). The information is written from left to right, with lowest option numbers first.

Option

Bit No.

Information Type

1

0

Drive type

2

1

Drive letter and colon (e.g. C:)

4

2

Volume name

8

3

Total volume space (in bytes)

16

4

Volume space available (in bytes) for consumption  

Comments: This function will only return information on network drives that have been assigned drive letters (i.e. those having been used in a Windows™ command prompt "net use" statement or VTScada Redirect statement).

This function returns a single-dimension array of text values (one element per drive). Each text value contains the information specified by Option for each drive that matches Attributes. The size information is expressed as a text string of a decimal number of the requested value concatenated with the other information. The drive type is returned as a number, as shown in the following table.

Value

Drive Type

0

Removable drive (floppy disk)

1

Fixed drive (hard disk)

2

Remote drive (network disk)

3

CD-ROM drive

Example:

[
  Title = "OverviewLabel";
  Color;
  Drives;
  Titles;
]
Init [
  If ! Valid(Drives) Main;
  [
    Drives = DriveInfo(6 { All hard and network disks }, 
                       6 { Drive letter and volume name }); 
    Titles = New(1);
    Titles[0] = "Drive List";
  ]
]
 
Main [
  Return(Self);
  GUITransform(0, 1, 1, 0,
               1 - 100, 500, 500, 1 - (100), 1,
               0, 0, 1, 0,
               0, 0, 0,
               \System\GridList(Titles { Column Titles Array },
                                Drives { Data Array          },
                                "%s"   { Format for Text     }));
]

This would list the drive letters and volume names, both fixed and remote, available on the system in table form on the Overview page.