I have looked through MANY questions asked and none of the solutions are working for me. I want to run an md5sum check on all files in all subdirectories from that specified in cd [directory]. Example:
cd [directory]
for f in *; do
if [[ -f "$f" ]]; then
(md5sum -- "$f" > "md5_${f}")
fi
done
Thanks to a commentor, I understood my initial error which took my command as a directory instead of running it.
The issue now is that it runs successfully in the first directory it is looking at, but does not run correctly in sub-directories.
Per comment
find . - type f ! - name /'md5_*' -execdir sh -c /
for f; do
b="$(basename "$f")";
[ ! -e "md5_$b" ] && md5sum "$b" > "md5$b"
done
output find: paths must precede expression: - Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
( MY COMMAND )
by( ./PATH/TO/MY/COMMAND )
?