Scripting Object - VcFileManager

Scripting-object corresponding to
FileManager
Attribute of
VcSdkConnection, VcServiceContent

Scripting Object Description

This managed object type provides a way to manage and manipulate files and folders on datastores. The source and the destination names are in the form of a URL or a datastore path.

A URL has the form

scheme://authority/folder/path?dcPath=dcPath&dsName=dsName
where
  • scheme is http or https.
  • authority specifies the hostname or IP address of the VirtualCenter or ESX server and optionally the port.
  • dcPath is the inventory path to the Datacenter containing the Datastore.
  • dsName is the name of the Datastore.
  • path is a slash-delimited path from the root of the datastore.
  • A datastore path has the form

    [datastore] path
    where
  • datastore is the datastore name.
  • path is a slash-delimited path from the root of the datastore.
  • An example datastore path is "[storage] path/to/file.extension". A listing of all the files, disks and folders on a datastore can be obtained from the datastore browser.

    Attributes

    Name Type Description
    idString

    @since Unknown
    morefVcManagedObjectReference

    returns the ManagedObjectReference of this ManagedObject @since Unknown
    sdkConnectionVcSdkConnection

    @since Unknown
    sdkIdString

    @since Unknown
    typeStringDeprecated.

    Returns the name for the this managed object's vim type @since Unknown
    vimHostVcSdkConnection

    @since Unknown
    vimIdString

    @since Unknown
    vimTypeString

    @since Unknown

    Methods

    Methods defined in this Scripting Object
    _getRef, changeOwner, copy_Task, copyDatastoreFile_Task, createTrigger, delete_Task, deleteDatastoreFile_Task, makeDirectory, move_Task, moveDatastoreFile_Task, uploadFileToDatastore

    deleteDatastoreFile_Task

    Deletes the specified file or folder from the datastore. If a file of a virtual machine is deleted, it may corrupt that virtual machine. Folder deletes are always recursive. The datacenter parameter may be omitted if a URL is used to name the file or folder.

    If the source is an extent of a virtual disk, this operation treats the extent as a file.

    It is important to note that this operation will provide transactional guarantees only for a file. No guarantees are provided when deleting folders. If the intent is to delete a virtual machine registered in the inventory, please refer to {@link vim.ManagedEntity#destroy}.

    Requires Datastore.FileManagement privilege on the datastore.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0String

    arg1VcDatacenter


    Return Value

    Type Description
    VcTask

    _getRef

    @since Unknown

    Parameters

    NameTypeDescription
    None

    Return Value

    Type Description
    VcManagedObjectReference

    makeDirectory

    Create a folder using the specified name. If the parent or intermediate level folders do not exist, and the parameter createParentDirectories is false, a {@link vim.fault.FileNotFound} fault is thrown. If the intermediate level folders do not exist, and the parameter createParentDirectories is true, all the non-existent folders are created.

    Requires Datastore.FileManagement privilege on the datastore.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0String

    arg1VcDatacenter

    arg2Boolean


    Return Value

    Type Description
    None

    createTrigger

    @since Unknown

    Parameters

    NameTypeDescription
    timeoutNumber

    filterString

    conditionString

    filterToSyncString


    Return Value

    Type Description
    Trigger

    copy_Task

    Copies the file, disk or folder from the source path in the source datacenter to the destination path in the destination datacenter. Both source and destination paths should be valid datastore paths. If the destination datacenter is not specified, it is assumed that the source and destination paths both belong to the source datacenter.

    It is acceptable if the source and destination paths are both a file or disk. In this case, if the destination file or disk does not exist, it is created. If the destination file or disk exists, the force parameter determines whether to overwrite it with the source or not. Folders can be copied recursively. In this case, the destination, if it exists, must be a folder, else one will be created. Existing files on the destination that conflict with source files can be overwritten using the force parameter. Files and disks are always copied in binary format during recursive copy.

    If any intermediate level folder specified by the source and destination paths does not exist, a {@link vim.fault.FileNotFound} fault is thrown.

    All disks will be copied over in binary format. Sparse disks will retain their sparse format at the destination. If a file or disk of a virtual machine is overwritten on the destination datastore as a result of the force parameter, it may corrupt that virtual machine.

    If the fileType parameter is specified as File, when in fact the source path is an extent of a virtual disk, this operation is performed only on that extent. If the fileType parameter is specified as VirtualDisk, and the source path is a virtual disk, then this operation is performed on all its extents.

    If source and destination resolve to the same file system location, the call has no effect.

    It is important to note that this operation will provide transactional guarantees only for a file or a disk. No guarantees are provided when copying a folder. If the intent is to clone a virtual machine registered in the inventory, with transactional guarantees, please refer to the virtual machine {@link vim.VirtualMachine#clone}.

    Datastore.FileManagement privilege is required on both source and destination datastores.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0VcDatacenter

    arg1String

    arg2VcDatacenter

    arg3String

    arg4Boolean

    arg5String


    Return Value

    Type Description
    VcTask

    moveDatastoreFile_Task

    Moves the source file or folder to the destination.

    If the destination file does not exist, it is created. If the destination file exists, the force parameter determines whether to overwrite it with the source or not. If the source path is a folder, then the destination path must not exist; the destination cannot be overwritten even with a force flag in that case. Folder moves are recursive, treating all files and disks to move as binary.

    If source (or destination) name is specified as a URL, then the corresponding datacenter parameter may be omitted.

    If any intermediate level folder specified by the source and destination does not exist, a {@link vim.fault.FileNotFound} fault is thrown.

    If a file of a virtual machine is moved, it may corrupt that virtual machine. If a file of a virtual machine is overwritten on the destination datastore as a result of the force parameter, it may corrupt that virtual machine.

    If the source is an extent of a virtual disk, this operation treats the extent as a file.

    If source and destination resolve to the same file system location, the call has no effect.

    It is important to note that this operation will provide transactional guarantees only for a file. No guarantees are provided for folder moves. If the intent is to move a virtual machine registered in the inventory, with transactional guarantees, please refer to {@link vim.VirtualMachine#relocate}. If the intent is to rename a virtual machine registered in the inventory, please refer to {@link vim.ManagedEntity#rename}.

    Datastore.FileManagement privilege is required on both source and destination datastores.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0String

    arg1VcDatacenter

    arg2String

    arg3VcDatacenter

    arg4Boolean


    Return Value

    Type Description
    VcTask

    move_Task

    Moves the file, disk or folder from the source path in the source datacenter to the destination path in the destination datacenter. Both source and destination paths should be valid datastore paths. If the destination datacenter is not specified, it is assumed that the source and destination paths both belong to the source datacenter.

    It is acceptable if the source and destination paths are both a file or disk. In this case, if the destination file or disk does not exist, it is created. If the destination file or disk exists, the force parameter determines whether to overwrite it with the source or not. If the source path is a folder, then the destination path must not exist; the destination cannot be overwritten even with a force flag in that case. Folder moves are recursive, treating all files and disks to move as binary.

    If any intermediate level folder specified by the source and destination paths does not exist, a {@link vim.fault.FileNotFound} fault is thrown.

    All disks will be moved over in binary format. Sparse disks will retain their sparse format at the destination. If a file or disk of a virtual machine is moved, it may corrupt that virtual machine. If a file or disk of a virtual machine is overwritten on the destination datastore as a result of the force parameter, it may corrupt that virtual machine.

    If the fileType parameter is specified as File, when in fact the source path is an extent of a virtual disk, this operation is performed only on that extent. If the fileType parameter is specified as VirtualDisk, and the source path is a virtual disk, then this operation is performed on all its extents.

    If source and destination resolve to the same file system location, the call has no effect.

    It is important to note that this operation will provide transactional guarantees only for a file or a disk. No guarantees are provided for folder moves. If the intent is to move a virtual machine registered in the inventory, with transactional guarantees, please refer to {@link vim.VirtualMachine#relocate}. If the intent is to rename a virtual machine registered in the inventory, please refer to {@link vim.ManagedEntity#rename}.

    Datastore.FileManagement privilege is required on both source and destination datastores.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0VcDatacenter

    arg1String

    arg2VcDatacenter

    arg3String

    arg4Boolean

    arg5String


    Return Value

    Type Description
    VcTask

    changeOwner

    Change the owner for a file.

    This method is currently not supported.

    @since vSphere API 4.0

    Parameters

    NameTypeDescription
    arg0String

    arg1VcDatacenter

    arg2String


    Return Value

    Type Description
    None

    copyDatastoreFile_Task

    Copies the source file or folder to the destination.

    If the destination file does not exist, it is created. If the destination file exists, the force parameter determines whether to overwrite it with the source or not. Folders can be copied recursively. In this case, the destination, if it exists, must be a folder, else one will be created. Existing files on the destination that conflict with source files can be overwritten using the force parameter. Files and disks are always copied in binary format during recursive copy.

    If source (or destination) name is specified as a URL, then the corresponding datacenter parameter may be omitted.

    If any intermediate level folder specified by the source and destination does not exist, a {@link vim.fault.FileNotFound} fault is thrown.

    If a file of a virtual machine is overwritten on the destination datastore as a result of the force parameter, it may corrupt that virtual machine.

    If the source is an extent of a virtual disk, this operation treats the extent as a file.

    If source and destination resolve to the same file system location, the call has no effect.

    It is important to note that this operation will provide transactional guarantees only for a file. No guarantees are provided when copying a folder. If the intent is to clone a virtual machine registered in the inventory, with transactional guarantees, please refer to {@link vim.VirtualMachine#clone}.

    Datastore.FileManagement privilege is required on both source and destination datastores.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0String

    arg1VcDatacenter

    arg2String

    arg3VcDatacenter

    arg4Boolean


    Return Value

    Type Description
    VcTask

    delete_Task

    Deletes the specified file, disk or folder from the datastore. If a file or disk of a virtual machine is deleted, it may corrupt that virtual machine. Folder deletes are always recursive.

    If the fileType parameter is specified as File, when in fact the source path is an extent of a virtual disk, this operation is performed only on that extent. If the fileType parameter is specified as VirtualDisk, and the source path is a virtual disk, then this operation is performed on all its extents.

    It is important to note that this operation will provide transactional guarantees only for a file or a disk. No guarantees are provided when deleting folders. If the intent is to delete a virtual machine registered in the inventory, please refer to {@link vim.ManagedEntity#destroy}.

    Requires Datastore.FileManagement privilege on the datastore.

    @since VI API 2.5

    Parameters

    NameTypeDescription
    arg0VcDatacenter

    arg1String

    arg2String


    Return Value

    Type Description
    VcTask

    uploadFileToDatastore

    @since Unknown

    Parameters

    NameTypeDescription
    datacenterVcDatacenter

    datastoreVcDatastore

    srcFilePathString

    destFilePathString


    Return Value

    Type Description
    Boolean