How to combine the output of multiple `find` commands?
Combining:
find -type f \( -name "*.avi" -or -name '*.mp4' \) -exec md5sum {} + > checklist.chk
Adding output to one file:
find -type f -name "*.avi" -exec md5sum {} + > checklist.chk
find -type f -name "*.mp4" -exec md5sum {} + >> checklist.chk
There are many ways to do this:
Using Or -o
:
find . -type f \( -name '*.avi' -o -name '*.mp4' \) -exec md5sum {} + > checklist.chk
Using Regex:
find . -type f -regextype posix-extended -regex '.*\.(avi|mp4)$' -exec md5sum {} + > checklist.chk
Both will write the output to the file checklist.chk
.