Commands related to files, disks and volumes
package require twapi
This package provides procedures related to file, disk and volume information in Windows operating systems.
The command find_volumes returns a list of volumes on the system. The command get_volume_info returns various information about a volume (logical drive) including size and space utilization, file system characteristics and device.
The command find_volume_mount_points returns the list of volume mount points on a particular volume. Commands mount_volume and unmount_volume can be used to set and remove volumes from volume mount points. The command get_mounted_volume_name will return the name of the volume mounted on a drive letter or volume mount point.
The command volume_properties_dialog displays the shell property sheet dialog for a volume.
For all drive related 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 find_logical_drives returns a list of drives in the system of a specified type. 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_label may be used to set the volume name (drive label).
The command map_drive_local and unmap_drive_local may be used to assign and unassign a drive letter to a local path.
The commands begin_filesystem_monitor and cancel_filesystem_monitor can be used for monitoring changes to the file system.
The get_file_version_resource returns various information stored within the version resource of a file.
The command file_properties_dialog displays the shell property sheet dialog for a file.
The commands get_file_times and set_file_times and allow retrieval and setting of the times associated with a file.
-access BOOLEAN | If true, changes to the last access time are monitored. |
-attr BOOLEAN | If true, attribute changes, are monitored. |
-create BOOLEAN | If true, changes to the creation times are monitored. |
-dirname BOOLEAN | If true, directory name changes, including creation and renaming, are monitored. |
-filename BOOLEAN | If true, file name changes, including file creation, renaming and deletion, are monitored. |
-secd BOOLEAN | If true, changes to security descriptors in the specified directories are monitored. |
-size BOOLEAN | If true, size changes in the specified directories are monitored. |
-subtree BOOLEAN | If true, all subdirectories under the specified directory PATH are monitored in addition to PATH itself. If false (default), only the directory indicated by PATH is monitored. |
-write BOOLEAN | If true, changes to the last write time of files in the specified directories are monitored. |
added | The file or directory was added. |
removed | The file or directory was deleted. |
modified | The file or directory was modified. This includes changes to attributes or timestamps. |
renameold | The file or directory was renamed. The associated name is the old name. |
renamenew | The file or directory was renamed. The associated name is the new name. |
-hwin HWIN | If specified, HWIN is the handle to the window to be used as the parent for the dialog. |
-page PAGENAME | Specifies the name of the property sheet page to be displayed. If unspecified, the default page is displayed. |
-all | Returns all fields. |
-atime | Returns the time of last access for the file. |
-ctime | Returns the creation time for the file. |
-mtime | Returns the time of last modification for the file. |
-all | Returns all information in the fixed part. |
-fileversion | Returns the file version as indicated in the version resource. This is returned in the format MAJOR.MINOR.BUILD.PRIVATE. Note this is not necessarily identical to the value specified for the FileVersion entry in the string table. |
-fileos | Returns a value specifying the platform for which the file was designed. This may be one of dos (MS-DOS), os216 (16-bit OS/2), os232 (16-bit OS/2), nt (Windows NT), wince (Windows CE), windows16 (16-bit Windows), pm16 (16-bit Presentation Manager), pm32 (32-bit Presentation Manager), windows32 (32-bit Windows), dos_windows32 (32-bit Windows on MS-DOS), os216_pm16 (16-bit Presentation Manager on 16-bit OS/2), os232_pm32 (32-bit Presentation Manager on 32-bit OS/2) or nt_windows32 (32-bit Windows on Windows NT). |
-filetype | Returns the file type which may be one of the following: application, dll, driver.printer, driver.keyboard, driver.language, driver.display, driver.mouse, driver.network, driver.system, driver.installable, driver.sound, driver.comm, driver.inputmethod, driver.versionedprinter, driver.DRIVERSUBTYPENUMBER, font.raster, font.vector, font.truetype, font.FONTSUBTYPENUMBER, vxd.VIRTUALDEVICEID, staticlib or FILETYPENUMBER.FILESUBTYPENUMBER. (Note in cases where the file type or subtype is not recognized, the actual numeric value is returned.) |
-flags | Returns a list of symbols corresponding to flags set in the version resource. The list may contain symbols from the following: debug, prerelease, patched, privatebuild, infoinferred and specialbuild. In addition, the list may also contain a numeric value corresponding to bits that are set but are not recognized as one of the above. |
-langid LANGID | Specifies LANGID as the language identifier to be used for string table lookup (see below). By default, the language identifier returned by get_user_ui_langid is used. |
-codepage CODEPAGE | Specifies CODEPAGE as the code page to be used for string table lookup (see below). |
-productversion | Returns the product version as indicated in the version resource. This is returned in the format MAJOR.MINOR.BUILD.PRIVATE. Note this is not necessarily identical to the value specified for the ProductVersion entry in the string table. |
-signature | Contains a longword that is a signature for the fixed part of the version resource. Not particularly useful for the application. |
-structversion | Returns the version of the version resource format. |
-all | Returns all fields except -type and -device which have to be explicitly specified since they are not valid for volumes. |
-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. |
-device | Returns a list the first element of which is the device name mapping for the drive. Remaining elements containing prior undeleted mappings for the drive. Only valid if DRIVE is a drive letter. |
-freespace | Returns the total size of the unused space on the drive in bytes. |
-fstype | Returns the type of the file system on the volume (eg. NTFS). |
-label | Returns the label of the drive. |
-maxcomponentlen | Returns the maximum length allowed for a single component in a file path. |
-serialnum | Returns the serial number of the drive in hexadecimal format. |
-size | Returns the size of the drive in bytes. |
-type | Returns the type of the drive. Only valid if DRIVE is a drive letter. 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. |
-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. |
-raw | Specifies that PATH is a raw path specification that includes the device name as opposed to a drive letter. |
-atime LARGETIMESTAMP | Sets the time of last access for the file. |
-ctime LARGETIMESTAMP | Sets the creation time for the file. |
-mtime LARGETIMESTAMP | Sets the time of last modification for the file. |
-preserveatime | Indicates that the time of last access for an open file should be preserved and not updated when the file is closed. This option can only be specified if FILE is either an open Tcl channel or Win32 handle and not if it is a file path. Also, the option cannot be used together with -atime. |
-path PATH | Specifies that the drive should be unmapped only if it refers to the location specified by PATH. This is useful to ensure drive letters are not unmapped when they have been redefined to point elsewhere. |
-raw | Specifies that PATH argument specified with the -path option is a raw path specification that includes the device name as opposed to a drive letter. |
-hwin HWIN | If specified, HWIN is the handle to the window to be used as the parent for the dialog. |
-page PAGENAME | Specifies the name of the property sheet page to be displayed. If unspecified, the default page is displayed. |
Copyright © 2003-2007 Ashok P. Nadkarni