public void RenameFolder(string path, string newPath)
{
var fullNewPath = newPath;
EnsurePathIsRelativeAndEnsureContainer(ref path);
var container = EnsurePathIsRelativeAndEnsureContainer(ref newPath);
if (path == "")
throw new ArgumentException("Renaming root folders represented by azure containers is not currently supported", path);
if (!path.EndsWith("/"))
path += "/";
if (!fullNewPath.EndsWith("/"))
fullNewPath += "/";
foreach (var blob in container.GetDirectoryReference(path).ListBlobs())
{
if (blob is CloudBlockBlob)
{
var azureBlob = new AzureBlobFileStorage((CloudBlockBlob)blob, this);
RenameFile(azureBlob.GetPath(), Combine(fullNewPath, azureBlob.GetName()));
}
if (blob is CloudBlobDirectory)
{
var azureFolder = new AzureBlobFolderStorage((CloudBlobDirectory)blob, this);
RenameFolder(azureFolder.GetPath(), Path.Combine(fullNewPath, azureFolder.GetName()));
}
}
}