Question

I would like to ask if anyone knows about reliability of File.Copy in a UNC path file copy. I have a file locally and the target is an smb share (SAMBA etc). Take for granted that the impersonation has took place successfully and I can execute commands with full credentials. Is there any way to check whether the file is properly copied?

-The solution of an integrity test will require to transfer data back, as the CIFS underlying protocol doesn't have the relevant control mechanisms (md5, etc).

-The only thing I have found is that the protocol has actually a write validation flag (check cifs spec at page 80) but how can this be setted through .NET? There isn't an after-copy validation test as far as I understand through the documented exceptions.

Was it helpful?

Solution

I would hash the file before and after the copy and then make sure that the hashes are identical.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top