I have a a directory with a structure like so:
.
├── Test.txt
├── Test1
│ ├── Test1.txt
│ ├── Test1_copy.txt
│ └── Test1a
│ ├── Test1a.txt
│ └─
#!/bin/bash
shopt -s globstar
md5sum "$1"/** > "${1}__checksums.md5"
Explanation: shopt -s globstar
(manual) enables **
recursive glob wildcard. It will mean that "$1"/**
will expand to list of all the files recursively under the directory given as parameter $1
. Then the script simply calls md5sum
with this file list as parameter and > "${1}__checksums.md5"
redirects the output to the file.