Monday, April 29, 2024
168
rated 0 times [  168] [ 0]  / answers: 1 / hits: 277028  / 3 Years ago, sun, june 27, 2021, 1:53:52

I would like to create a md5 checksum list for all files in a directory.



I want to cat filename | md5sum > ouptput.txt. I want to do this in 1 step for all files in my directory.



Any assistance would be great.


More From » command-line

 Answers
3

You can pass md5sum multiple filenames or bash expansions:



$ md5sum * > checklist.chk  # generates a list of checksums for any file that matches *
$ md5sum -c checklist.chk # runs through the list to check them
cron: OK
database.sqlite3: OK
fabfile.py: OK
fabfile.pyc: OK
manage.py: OK
nginx.conf: OK
uwsgi.ini: OK


If you want to get fancy you can use things like find to drill down and filter the files, as well as working recursively:



find -type f -exec md5sum "{}" + > checklist.chk

[#30372] Tuesday, June 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skaing

Total Points: 462
Total Questions: 124
Total Answers: 113

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
;