I'm copying files from Azure file shares to CloudBlockBlob in a storage container. I want to verify that the bytes (.Properties.Length) is the same in both locations before I delete the original. I thought it would be a case of getting a new reference to the copied blob, however it is always -1.
The copy works fine and a visual inspection of the file v blob shows the bytes are identical, just not sure how to replicate this in my C# application.
The line I'm having issues with is the one that defines the "copied" object.
string myfile = @"junk.txt";
CloudFile sourcefile =
fileStorage.Share.GetRootDirectoryReference().GetFileReference(myfile);
CloudBlockBlob destBlob =
destStorage.Container.GetBlockBlobReference(myfile);
string fileSAS = sourcefile.GetSharedAccessSignature(new
SharedAccessFilePolicy()
{
Permissions = SharedAccessFilePermissions.Read,
SharedAccessExpiryTime = DateTime.Now.AddHours(24)
});
Uri fileUri = new Uri(sourcefile.StorageUri.PrimaryUri.ToString() + fileSAS);
CloudBlockBlob destBlob = destStorage.Container.GetBlockBlobReference(file.Path);
destBlob.StartCopy(fileUri);
CloudBlockBlob copied = destStorage.Container.GetBlockBlobReference(myfile);