How to move a file on Azure File Storage from one sub folder to another sub folder using the Azure Storage SDK?

This is documented in the Getting Started guide on Azure Storage Files reference.

What you need is the StartCopy method to copy the file from one location to another.

// Start the copy operation.
destinationFile.StartCopy(sourceFile);

And, yes, you will have to create the destination directory if it does not exist.


Like this:

public static void MoveTo(this CloudFile source, CloudFileDirectory directory)
{
    var target = directory.GetFileReference(source.Name);
    target.StartCopy(source);
    source.Delete();
}

Unfortunately we don't have move / rename functionality exposed through the REST API that the Client SDK's are dependent on. You can of course perform these functions via SMB. We do have these features on our backlog but don't have a timeline yet for implementation.