I could manage to generate a hash file for each file not yet hashed recursively:
find . -type f ! -name '*.sha256' -execdir sh -c '[ ! -f "$1.sha256" ] && sha256sum "$1" > "$1.sha256"' _ {} \;
I can´t get it to produce hidden files prefixed with a dot. Adding a .
like so
find . -type f ! -name '*.sha256' -execdir sh -c '[ ! -f "$1.sha256" ] && sha256sum "$1" > ".$1.sha256"' _ {} \;
This produces no output.
I can´t figure out how to add the .
prefix or how to escape it.
I tried to isolate the variable like ${1}
or {$1}
. This also didn´t help.
I got the current generation for non-hidden files extrapolated from this question and its solution.
I would be perfectly happy to have a bash script to call to do the job if it is easier to produce. I would need the solution to work on Debian and Ubuntu Linux.