bash - calculate md5 sum of entire directory

Bash
[Edit]
+
0
-
0

Bash - calculate MD5 sum of entire directory

9600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# ⚠️ WARNING ⚠️: do not change `.` path in the used `find` commands. cd /path/to/directory && ( find . -type d | LC_ALL=C sort; find . -type f -exec md5sum {} + | LC_ALL=C sort -k 2 ) | md5sum; cd - > /dev/null # Where: the command: # - finds all directories located under /path/to/directory location, # - finds all regular files located under /path/to/directory location and computes MD5 sums for them, # - computes and prints final MD5 sum for directories and regular files # Example output: # # 912cb5810f4cf3555478715bc9a2e6c0 -