File Manager Move Datastore File 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 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 RelocateVM_Task. If the intent is to rename a virtual machine registered in the inventory, please refer to Rename_Task.
Datastore.FileManagement privilege is required on both source and destination datastores.
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 FileManager/{moId}
.
The vSphere release schema. The current specification covers vSphere 8.0.3.0 APIs.
Show optional properties
{
"sourceName": "string",
"destinationName": "string"
}
{
"sourceName": "string",
"sourceDatacenter": {
"_typeName": "string",
"type": "string",
"value": "string"
},
"destinationName": "string",
"destinationDatacenter": {
"_typeName": "string",
"type": "string",
"value": "string"
},
"force": false
}
The name of the source, either a URL or a datastore path referring to the file or folder to be moved.
Reference to an instance of the Datacenter managed object.
The name of the destination, either a URL or a datastore path referring to the destination file or folder.
Reference to an instance of the Datacenter managed object.
If true, overwrite any identically named file at the destination. If not specified, it is assumed to be false.
This method returns a Task object with which to monitor the operation.
{
"_typeName": "string",
"type": "string",
"value": "string"
}
InvalidDatastore: if the operation cannot be performed on the source or destination datastores. Typically, a specific subclass of this exception is thrown.
FileNotFound: if the file or folder specified by sourceName is not found, or, any intermediate level folder specified by the destinationName is not found.
CannotAccessFile: if the source file or folder cannot be moved because of insufficient permissions.
FileLocked: if the source file or folder is currently locked or in use.
FileAlreadyExists: if a file with the given name already exists at the destination, and the force flag is false. For folders, if the destination exists, this fault is thrown regardless.
NoDiskSpace: if there is not enough space available on the destination datastore.
FileFault: if there is a generic file error
{
"_typeName": "string",
"faultCause": "MethodFault Object",
"faultMessage": [
{
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
}
]
}