Name
ListDirectoryInGuest
Description
HRESULT
ListDirectoryInGuest([in] BSTR pathName,
[in] LONG options,
[in] ICallback* jobDoneCallback,
[out,retval] IJob** listJob);
This function lists a directory in the guest operating system.
Parameters
- pathname
-
The path name of a directory to be listed.
- options
-
Must be 0.
- jobDoneCallback
-
An ICallback instance that will be called when the
operation is complete.
- listJob
-
Returns an IJob object that describes the state of this asynchronous operation.
Return Value
HRESULT
Remarks
- You must call VM::LoginInGuest() before calling this function.
- Job::GetNumProperties() should be used to determine the number of results.
- Job::GetNthProperties() can be used to get each result.
- When the job is signaled, the following list of properties will be available
on the returned IJob object:
- VIX_PROPERTY_JOB_RESULT_ITEM_NAME: the file name
- VIX_PROPERTY_JOB_RESULT_FILE_FLAGS: file attribute flags
- VIX_PROPERTY_JOB_RESULT_FILE_MOD_TIME: The modification time of the file or directory as a 64-bit integer.
- Only absolute paths should be used for files in the guest; the resolution of
relative paths is not specified.
Side Effects
None.
Requirements
VixCOM.h, since VMware Workstation 6.0
Example
Set job = vm.ListDirectoryInGuest(pathname, 0, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
WScript.Echo("Error: " & lib.GetErrorText(err, empty))
WScript.Quit
End If
numResults = job.GetNumProperties(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME)
For i = 0 to numResults-1
err = job.GetNthProperties(i, Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME), results)
If lib.ErrorIndicatesFailure(err) Then
WScript.Echo("Error: " & lib.GetErrorText(err, empty))
WScript.Quit
End If
' Print the names of files in the directory.
WScript.Echo(results(0))
Next