Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash get one checksum for many files

# Basic syntax:
find /directory/to/search -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum > single_md5sum.txt

# Where:
#	- find -type f returns all files (but not directories) in 
#		/directory/to/search and its subdirectories
#	- -exec md5sum {} obtains the md5 checksums for all files returned 
#		with find
#	- awk '{print $1}' | sort returns the sorted md5 checksums
#	- and finally, md5sum is run on the sorted list of md5 checksums to
#		return one md5 checksum for all the files
 
PREVIOUS NEXT
Tagged: #bash #checksum #files
ADD COMMENT
Topic
Name
7+4 =