Created
January 19, 2018 22:11
-
-
Save mcharytoniuk/c2e11e63ba76e287536ccff1f5836b16 to your computer and use it in GitHub Desktop.
replace filenames with file's md5 sum
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
ls -1 -A | while IFS= read FILE; do | |
EXTNAME=`echo $FILE | rev | cut -f 1 -d '.' | rev`; | |
# https://stackoverflow.com/questions/3679296/only-get-hash-value-using-md5sum-without-filename | |
NEWNAME=`md5sum "$FILE" | awk '{ print $1 }'`\.$EXTNAME; | |
mv "$FILE" $NEWNAME; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment