Anyone know the specifics on how Windows moves a file?
Devilsbane
Member Posts: 4,214 ■■■■■■■■□□
in Off-Topic
I was moving a folder from one network drive to another. During the move my network connection was interrupted. After reconnecting, I started the move over and it appears successful other than I have 1 file that exists in both places. It is the same size (down to the byte) and has the same created and modified times.
One would think that the files would be identical, but because these files are somewhat important I decided to do a hash on them. Both the MD5 and SHA1 hashes are different.
I know that during the move, the file will be copied and then deleted from the source location. But does it delete the whole file at the end or is something happening during the move? My guess would be that the first thing Windows does is create the file on the new volume and reserve the entire space that is needed for the file. The next step would be to create the file attributes, then to move the data, and finally to delete the original file. Since my move was interrupted somewhere during the data move, the files appear to be identical sizes, but really the destination file is only half a file and half "white space". If that is the case, I should re-move the file and choose to overwrite the destination. But for the time being I have said no to overwriting and just have 2 versions of the file (which appear identical to windows).
Anyone have any experience with this?
By the way, the file is part of a series of data ****. I can't just open the file (like you could a word document) and see if it is there or not.
One would think that the files would be identical, but because these files are somewhat important I decided to do a hash on them. Both the MD5 and SHA1 hashes are different.
I know that during the move, the file will be copied and then deleted from the source location. But does it delete the whole file at the end or is something happening during the move? My guess would be that the first thing Windows does is create the file on the new volume and reserve the entire space that is needed for the file. The next step would be to create the file attributes, then to move the data, and finally to delete the original file. Since my move was interrupted somewhere during the data move, the files appear to be identical sizes, but really the destination file is only half a file and half "white space". If that is the case, I should re-move the file and choose to overwrite the destination. But for the time being I have said no to overwriting and just have 2 versions of the file (which appear identical to windows).
Anyone have any experience with this?
By the way, the file is part of a series of data ****. I can't just open the file (like you could a word document) and see if it is there or not.
Decide what to be and go be it.
Comments
-
j23evan Member Posts: 135 ■■■■□□□□□□You are exactly correct on how Windows moves files. If you did try to open the file it would give you a corruption error. Depending on what OS you are using overwrite can be a bit buggy. I would suggest deleting the half moved item, and then recopying it over.https://vWrong.com - Microsoft Certified Trainer 2013-2018 - VMware vExpert 2014-2018 - Cisco Champion 2018 - http://linkedin.com/in/j23evan/
-
Devilsbane Member Posts: 4,214 ■■■■■■■■□□I restored a version of the file from last night. The MD5 of that file matches the MD5 of the file in my source directory which does not match the MD5 in my destination. So with that, I would conclude that I should just move that file again and this time say yes to replacing.
Interesting nonetheless, an average user would look at the timestamps and file size and just assume that the files were actually the same. Very tricky Windows.Decide what to be and go be it. -
it_consultant Member Posts: 1,903You need to use robocopy and use the /z switch in case just this type of thing happens. I recommend using robocopy if you need to copy large amounts of small files or really large individual files.
-
jibbajabba Member Posts: 4,317 ■■■■■■■■□□It certainly is a bit annoying how it works but you are right. In fact, it even seems to start at the beginning of the file. For example, I copied a move across and it crashed half way. The file size was identical and even the length of the movie was displayed in the explorer correctly, but the movie stopped playing half way ...My own knowledge base made public: http://open902.com
-
Devilsbane Member Posts: 4,214 ■■■■■■■■□□I usually use robocopy for big or complicated moves. But I was just recovering some space and moving quickly so I wasn't too concerned. (Plus I had the back ups). Good learning moment though, I had never thought about the specifics in how it works.Decide what to be and go be it.