MD5 sum check
Hey guys,
I have had this question answered before on this site, but like a dummy I did not save my script. I'm trying to write a bash script that points to a file server to check for duplicate files. I have done some googling, but I see to be stuck on an if statement. here is what I have so far: "#!/bin/bash #This is a script to find duplicate files using Md5sum SRC_DIR=/directory/home/user/NOTES/ RESULT_FILE=/directory/home/home/checksum_result.txt FAILURE=/directory/home/user/checksum_fail.txt SUCCESS=/directory/home/user/checksum_win.txt cd $SRC_DIR find ./ -type f -exec md5sum {} \; > /directory/home/user/checksum.txt md5sum -c < /directory/home/user/checksum.txt > $RESULT_FILE if [ "$file1" != "$file2" ]; then" This is where I get stuck. " if [ "$file1" != "$file2" ]; " I'm not entirely sure if the IF statement is correct. I want it to compare the checksum.txt file to the RESULTS file, then print the duplicates into a checksum_fail.txt file. |
For starters, you need to setup the variables for $FILE1 and $FILE2; or show that part of the script, because right now those variables do not exist at the point which you are comparing them.
Please place your code within [code] tags. |
There is a logical error here. An md5sum is only accurate if two files have the same size. Two md5sums can be the same for two files of different size.
|
All times are GMT -5. The time now is 11:36 PM. |