Client. Rename(String, String, Boolean, CancellationToken) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Synchronous 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 bool Rename (string path, string destination, bool overwrite = false, System.Threading.CancellationToken cancelToken = default);
abstract member Rename : string * string * bool * System.Threading.CancellationToken -> bool override this.Rename : string * string * bool * System.Threading.CancellationToken -> bool
Public Overridable Function Rename (path As String, destination As String, Optional overwrite As Boolean = false, Optional cancelToken As CancellationToken = Nothing) As Boolean
Path of the source file or directory
For file: If true then overwrites the destination file if it exists For directory: If the destination directory exists, then this flag has no use. Because it puts the source one level under destination. If there is a subdirectory with same name as source one level under the destination path, this flag has no use, rename fails
CancellationToken to cancel the request
True if the path is renamed successfully else false