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

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.0
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux

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

Set results = Nothing
Set job = Nothing

Copyright (C) 2007-2011 VMware, Inc. All rights reserved.