Last active
October 22, 2016 21:28
-
-
Save deltheil/7232594 to your computer and use it in GitHub Desktop.
Files and directory comparison with md5deep matching mode (see http://md5deep.sourceforge.net/start-md5deep.html#match).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a reference folder with some data | |
mkdir foo | |
echo "hey" > foo/A.txt | |
echo "scm" > foo/B.txt | |
echo "git" > foo/C.txt | |
# Generate the list of hashes for each file | |
# -b = bare mode (strips any leading directory | |
# information from displayed filenames) | |
md5deep -b foo/* > hashes.txt | |
# Create a modified folder with some changes | |
# A.txt: modified | |
# C.txt: deleted | |
# D.txt: added | |
mkdir bar | |
echo "HEY" > bar/A.txt | |
echo "scm" > bar/B.txt | |
echo "svn" > bar/D.txt | |
# Find the positive matches with the -m option | |
# ~ find all unmodified files | |
md5deep -bm hashes.txt bar/* | |
# => B.txt | |
# Find the negative matches with the -x option | |
# ~ find all added or modified files | |
md5deep -bx hashes.txt bar/* | |
# => A.txt | |
# => D.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also Python
filecmp
: