0

We are migrating data to Azure file storage and want to validate the upload after it is complete before deleting the file from the local server.

Code below works fine, but I'm a little unclear from the docs on how to validate the file afterwards.

I was going to compare the byte count, but it looked like using transactionalCRC would work but I can't seem to get it implemented

MS Docs on CRC64

        byte[] theFile = UploadHelper.GetFileAsByteArray(theUpload);

        CloudFile theCloudFile = rootDir.GetFileReference(theUpload.Name);
        Stream theMemoryStream = new MemoryStream(theFile);
        await theCloudFile.UploadFromStreamAsync(theMemoryStream);

Or if I'm overthinking this and there is a better way I'd appreciate the insight.

Thank you,

  • If you have a backup I wouldn't do anything more. Provided Azure responds with a '201' result you can be confident it was successful. See also https://stackoverflow.com/questions/44395881/how-to-check-whether-azure-blob-storage-upload-was-successful – Ian Mercer Apr 15 '20 at 03:01

1 Answers1

0

The question as to how to validate the integrity of a file has a popular, accepted answer here:

Calculate MD5 checksum for a file

Patrick Goode
  • 1,412
  • 5
  • 20
  • 35