AzureBlobFileSystem.AzureBlobStorageProvider.RenameFile C# (CSharp) Method

RenameFile() public method

public RenameFile ( string path, string newPath ) : void
path string
newPath string
return void
        public void RenameFile(string path, string newPath)
        {
            EnsurePathIsRelativeAndEnsureContainer(ref path);
            var container = EnsurePathIsRelativeAndEnsureContainer(ref newPath);

            container.EnsureBlobExists(path);
            container.EnsureBlobDoesNotExist(newPath);

            var blob = container.GetBlockBlobReference(path);
            var newBlob = container.GetBlockBlobReference(newPath);
            newBlob.StartCopyFromBlob(blob);
            blob.Delete();
        }