Name
VMListDirectoryInGuest
Description
($err, @directoryContents) = VMListDirectoryInGuest($vmHandle,
$pathname,
$options);
This function lists a directory in the guest operating system.
Parameters
- vmHandle
-
Identifies a virtual machine. Call VMOpen() to create a virtual machine handle.
- pathname
-
The path name of a directory to be listed.
- options
-
Must be 0.
Return Value
$err. The error code returned by the operation. For returned values, see Topics > Error Codes.
@directoryContents. An array of hashes containing the directory information.
Remarks
- You must call VMLoginInGuest() before calling this function.
- @directoryContents is an array of hashes, containing the following values:
- FILE_NAME: the file name
- FILE_SIZE: file size as a 64-bit integer. The file size is zero for child directories.
- FILE_ATTRIBUTES: 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.
- 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.0
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux
Example
$(err, @directoryContents) = VMListDirectoryInGuest($vmHandle, $pathname, 0);
die "VMListDirectoryInGuest() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
my $num = @directoryContents;
my $i;
foreach $i (1..$num) {
print "file: $directoryContents[$i-1]{'FILE_NAME'}\t";
print "flags: $directoryContents[$i-1]{'FILE_ATTRIBUTES'}\t";
}