Share via


AdlsClient.RenameAsync(String, String, Boolean, CancellationToken) Method

Definition

Asynchronous API to rename a file or directory. For renaming directory: If the destination exists then it puts the source directory one level under the destination.

public virtual System.Threading.Tasks.Task<bool> RenameAsync (string path, string destination, bool overwrite = false, System.Threading.CancellationToken cancelToken = default);
abstract member RenameAsync : string * string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.RenameAsync : string * string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function RenameAsync (path As String, destination As String, Optional overwrite As Boolean = false, Optional cancelToken As CancellationToken = Nothing) As Task(Of Boolean)

Parameters

path
String

Path of the source file or directory

destination
String

Destination path. For directory: If the destination exists then it puts the source directory one level under the destination. If tthere is a subdirectory with same name as source one level under the destination path, rename fails

overwrite
Boolean

For file: If true then overwrites the destination file if it exists. Rename of folders cannot result in an overwrite of the target.

cancelToken
CancellationToken

CancellationToken to cancel the request

Returns

True if the path is renamed successfully else false

Applies to