Name
VMGetFileInfoInGuest
Description
($err, %fileInfo) = VMGetFileInfoInGuest($vmHandle,
$pathName);
This function returns information about a file in the guest operating system.
Parameters
- vmHandle
-
Identifies a virtual machine. Call VMOpen() to create a virtual machine handle.
- pathname
-
The path name of the file in the guest.
Return Value
$err. The error code returned by the operation. For returned values, see Topics > Error Codes.
%fileInfo. A hash containing the file information.
Remarks
- You must call VMLoginInGuest() before calling this function.
- %fileInfo is a hash containing the following values:
- FILE_SIZE: file size as a 64-bit integer.
This is 0 for directories.
- FILE_FLAGS: file attribute flags.
The flags are:
- VIX_FILE_ATTRIBUTES_DIRECTORY - Set if the pathname identifies a directory.
- VIX_FILE_ATTRIBUTES_SYMLINK - Set if the pathname identifies a symbolic link file.
- MOD_TIME: The modification time of the file or directory as a 64-bit integer specifying seconds since the epoch.
- Only absolute paths should be used for files in the guest; the resolution of
relative paths is not specified.
Side Effects
None.
Requirements
use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
since VMware Workstation 6.5
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux
Example
my $err;
my %fileInfo;
($err, %fileInfo) = VMGetFileInfoInGuest($vmHandle, $guestFile);
print "err: $err\n";
print "Size: $info{'FILE_SIZE'} ";
print "Flags: $info{'FILE_FLAGS'} ";
print "Modtime: $info{'FILE_MOD_TIME'} ";
print "\n";