Skip to main content

Commands: CopyAsync

Syntax

#Commands: CopyAsync

CopyAsync is used to copy the file.

Task CopyAsync(string sourceName, string targetName, Etag etag = null);
Parameters
sourceNamestringThe full path of the file that you want to copy from
targetNamestringThe name of the new file you want to copy to
etagEtagThe current file etag used for concurrency checks (null skips check)

Return Value
TaskA task that represents the asynchronous copy operation

Example

await store
.AsyncFilesCommands
.CopyAsync(
"/movies/intro.avi",
"/movies/copies/intro.avi"
);

Note that with file copy operation you can change the name of the file too:

await store
.AsyncFilesCommands
.CopyAsync(
"/movies/intro.avi",
"/movies/copies/newCopyFile.avi"
);