Guest File Manager List Files In Guest

Guest File Manager List Files In Guest

Returns information about files or directories in the guest.

The results could be extremely large, so to minimize the size of the return value for cases where a UI only needs to show the first N results, the answer is batched. Files are returned in OS-specific (inode) order. If the directory is modified between queries, missing or duplicate results can occur.

Request
URI
POST
https://{vcenter-host}/sdk/vim25/{release}/GuestFileManager/{moId}/ListFilesInGuest
COPY
Path Parameters
string
moId
Required

The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId, in this case GuestFileManager/{moId}.

string
release
Required

The vSphere release schema. The current specification covers vSphere 8.0.2.0 APIs.


Request Body
ListFilesInGuestRequestType of type(s) application/json
Required
{
    "vm": {
        "_typeName": "string",
        "type": "string",
        "value": "string"
    },
    "auth": {
        "_typeName": "string",
        "interactiveSession": false
    },
    "filePath": "string",
    "index": 0,
    "maxResults": 0,
    "matchPattern": "string"
}
vm
Required

Reference to an instance of the VirtualMachine managed object.

auth
Required

GuestAuthentication is an abstract base class for authentication in the guest.

string
filePath
Required

The complete path to the directory or file to query.

integer As int32 As int32
index
Optional

Which result to start the list with. The default is 0.

integer As int32 As int32
maxResults
Optional

The maximum number of results to return. The default is 50.

string
matchPattern
Optional

A filter for the return values. Match patterns are specified using perl-compatible regular expressions. If matchPattern is unset, then the pattern '.*' is used.

Authentication
This operation uses the following authentication methods.
Responses
200

A GuestListFileInfo object containing information for all the matching files in the filePath and the number of files left to be returned.

Returns GuestListFileInfo of type(s) application/json
This response body class contains all of the following: DataObject
{
    "_typeName": "string",
    "files": [
        {
            "_typeName": "string",
            "path": "string",
            "type": "string",
            "size": 0,
            "attributes": {
                "_typeName": "string",
                "modificationTime": "string",
                "accessTime": "string",
                "symlinkTarget": "string"
            }
        }
    ],
    "remaining": 0
}
files
Optional

A list of GuestFileInfo data objects containing information for all the matching files.

integer As int32 As int32
remaining
Required

The number of files left to be returned.

If non-zero, then the next set of files can be returned by calling ListFiles again with the index set to the number of results already returned.


500

GuestOperationsFault: if there is an error processing a guest operation.

GuestOperationsUnavailable: if the VM agent for guest operations is not running.

InvalidArgument: If the matchPattern is an invalid regular expression.

InvalidPowerState: if the VM is not powered on.

InvalidState: if the operation cannot be performed because of the virtual machine's current state.

TaskInProgress: if the virtual machine is busy.

GuestPermissionDenied: if the operation fails because the guest authentication will not allow the operation.

InvalidGuestLogin: if the the guest authentication information was not accepted.

GuestComponentsOutOfDate: if the guest agent is too old to support the operation.

OperationNotSupportedByGuest: if the operation is not supported by the guest OS.

OperationDisabledByGuest: if the operation is not enabled due to guest agent configuration.

Returns VimFault of type(s) application/json
This response body class contains all of the following: MethodFault
{
    "_typeName": "string",
    "faultCause": "MethodFault Object",
    "faultMessage": [
        {
            "_typeName": "string",
            "key": "string",
            "arg": [
                {
                    "_typeName": "string",
                    "key": "string",
                    "value": {
                        "_typeName": "string"
                    }
                }
            ],
            "message": "string"
        }
    ]
}