linux环境下

md5sum * | sed -e 's/\([^ ]*\) \(.*\(\..*\)\)$/mv -v \2 \1\3/e'

参考:https://www.coder.work/article/170705

OSX环境下

find . -type f -exec bash -c 'mv "$1" "$(md5 -q "$1").${1##*.}"' bash {} \;
find . -type f -exec bash -c 'cp "$1" "/path/to/cp/$(md5 -q "$1").${1##*.}"' bash {} \; #复制+md5重命名

参考:https://remarkablemark.org/blog/2017/09/24/rename-file-with-md5-hash/