Disk functions(n) "Disk information"
Disk functions - Functions related to disks and volumes
package require twapi
This package provides procedures related to disk and volume information
in Windows operating systems.
For all commands, the drive parameter may be specified as a single
drive letter, a drive letter followed by a :, or as the root path
of the drive (eg. C:\)
The command get_logical_drives returns a list of drives in the system
of a specified type.
The command get_drive_info returns various information about
a logical drive (volume) including size and space utilization,
file system characteristics. get_drive_type returns
the type (fixed, remote, etc.) of the logical drive.
The command user_drive_space_available can be used to check if
sufficient free space is available on a drive.
The command set_drive_volumename may be used to set the volume
name (drive label).
- user_drive_space_available drive space
-
Returns 1 if the given drive has at least space bytes free, and
0 otherwise. Note that space is compared to the free bytes
available to the caller as opposed to total free bytes on the drive. The
former may be smaller if disk quotas are being enforced on the drive.
- get_drive_info drive ?options?
-
Returns attributes and properties of the specified drive as a list of
the form "option1 value1 ...".
The values returned depend on which of the following options are specified:
- -all
- Returns all fields.
- -size
- Returns the size of the drive in bytes.
- -freespace
-
Returns the total size of the unused space on the drive in bytes.
- -used
-
Returns the total size of the used space on the drive in bytes.
- -useravail
-
Returns the total size of the unused space on the drive that is available
for the caller. This may be less than the freespace field if quotas are
in effect.
- -type
-
Returns the type of the drive.
This may have one of the values unknown,
removable, fixed, remote, cdrom or
ramdisk. In case the drive path is invalid, the value invalid
is returned in this field.
- -serialnum
-
Returns the serial number of the drive in hexadecimal format.
- -volumename
-
Returns the name of the drive volume.
- -maxcomponentlen
-
Returns the maximum length allowed for a single component in a file path.
- -fstype
-
Returns the type of the file system on the volume (eg. NTFS).
- -attr
- Returns a list containing one or more
of the values
case_preserved_names,
unicode_on_disk,
persistent_acls,
file_compression,
volume_quotas,
supports_sparse_files,
supports_reparse_points,
supports_remote_storage,
volume_is_compressed,
supports_object_ids,
supports_encryption,
named_streams, or
read_only_volume.
These indicate the features supported by the drive's file system. Refer
to the documentation for GetVolumeInformation function in the Windows SDK
for details on these.
- get_drive_type DRIVE
-
Returns the type of the drive - unknown,
removable, fixed, remote, cdrom or
ramdisk. In case the drive path is invalid, an error is generated.
- get_logical_drives ?-type DRIVETYPE?
-
Returns a list of the logical drives in the system. If option -type
not specified, all drives in the system are returned. Otherwise, only drives
of type DRIVETYPE are returned. DRIVETYPE must have one of the
values returned by the get_drive_type command.
- set_drive_volumename DRIVE NAME
-
Sets the volume name for the specified drive.
NAME may be an empty string
in which case the drive label is removed.
disk, disk serial number, disk space, drive, drive attributes, drive label, drive list, file system type, volume
Copyright © 2003, Ashok P. Nadkarni