Name
GetFileInfoInGuest
Description
HRESULT
GetFileInfoInGuest([in] BSTR pathName,
[in] ICallback* jobDoneCallback,
[out,retval] IJob** getFileInfoJob);
This function returns information about a file in the guest operating system.
Parameters
- pathname
-
The path name of the file in the guest.
- jobDoneCallback
-
An ICallback instance that will be called when the
operation is complete.
- getFileInfoJob
-
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.
- When the job is signaled, the following list of properties will be available
on the returned job object:
- VIX_PROPERTY_JOB_RESULT_FILE_SIZE: file size as a 64-bit integer.
This is 0 for directories.
- VIX_PROPERTY_JOB_RESULT_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.
- VIX_PROPERTY_JOB_RESULT_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
VixCOM.h, since VMware Workstation 6.5
Example
VBScript:
pathName = "C:\hello.txt"
Set job = vm.GetFileInfoInGuest(pathName, Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_FILE_SIZE), results)
If lib.ErrorIndicatesFailure(err) Then
WScript.Echo "Error: " & lib.GetErrorText(err, empty)
WScript.Quit
End If
WScript.Echo pathName & " is " & CStr(results(0)) & " bytes large."