Last active
June 18, 2023 20:04
-
-
Save theratman/6b934314e1600b68869c864c1f8faf0c to your computer and use it in GitHub Desktop.
Rename files to md5 sum plus extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# For Mac OS X version (md5) | |
MD="md5 -r" | |
# For Linux version (md5sum) | |
MD="md5sum" | |
for i in ./*; do | |
mv "${i}" "./$($MD "$i" | awk '{print $1}').${i##*.}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment