2

I’m doing a backup on my Samsung rv420 running Windows 7 Home Starter Edition.

In order to do it, I want to ensure that when making a copy from my computer to a external device, the files being copied do not change in the slightest. For that, I’ll do the next: I’ll take a file from my computer, copy it in the external device, and then copy it again from the external device to the computer. So the file has “traveled” trought the device, and I want to know if it's changed or not.

I know little abut hash functions. I have a program called FileMenu Tools that includes a function for calculating a couple of different hash algorithms. I hope the program does it job properly.

I did what I described with a file, I, logically, ended with two files, original and a copy I left in the desktop. I calculated the hash function and it wasn’t the same.

I don't know why is this. The hash varies upon in which directory is located a file?

What can you recommend me to achieve what I want, which is checking a file is exactly the same after traveling trought external device?

  • There isn't much to go on here. Why do you need to copy the file back? If you want to know that the exported copy matches, why not just compare its hash to the original file? What OS are you using? For simple file verification, you could use MD5, which is fast and simple to run from a command. Without knowing more about your software and what's going on, it's hard to speculate about why the hash might be different. – fixer1234 Aug 24 '15 at 4:35
  • I'm using windows 7 home starter on samsung rv420. The sofware is FileMenu Tools as said in the question. I need to copy again because I'm simulating a back up, to know if the files complete the back up intact. I'll try your suggestion in a couple of days. – Santropedro Aug 24 '15 at 4:40
  • 1
    So you're manually doing file backup/restore by copying the files to an external drive and copying them back, using file manager software? Your objective is just to pre-test the procedure to verify that it can restore your files without corruption? Have you thought about using software designed for the purpose (backup software)? That would give you benefits like automating the task, doing it in the background, etc. Many include hash verification so you don't have to manually spot-check files. There are lots of free utilities that will compare file hashes if you want to check FileMenu. – fixer1234 Aug 24 '15 at 5:11
2

A native solution to Windows (without downloading third party) is to use some powershell commands.

Open powershell.exe (either as user or admin). Then, use the following command.

Compare-Object "$(Get-Content $PATH1)" "$(Get-Content $PATH2)"

You can set $PATH1 and $PATH2 to your file paths and copy paste the command above.

If it returns nothing, the files are identical in content, which is what I believe you want. Note that this command does not check for identical permissions, identical modified date, etc. To compare identical modified date and mode, use the following command.

Compare-Object "$(Get-ItemProperty $PATH1 | Select-Object Mode, LastWriteTime)" "$(Get-ItemProperty $PATH2 | Select-Object Mode, LastWriteTime)"

To compare the permission, use the following command.

Compare-Object "$(Get-Acl $PATH1).Access" "$(Get-Acl $PATH2).Access"

Again, you can set $PATH1 and $PATH2 and just copy and paste the commands above.

In all three commands, if it returns something, you know that they are not the same. On the other hand, if it returns nothing, you know that they are exactly the same in content (1st command), last write time and mode (2nd command), and permissions (3rd command).

| improve this answer | |
1

In Powershell you can easily calculate file hash of both files and compare them

> Get-FileHash -Algorithm SHA256 .\file1.exe
> Get-FileHash -Algorithm SHA256 .\file2.exe
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.