Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
replace filenames with file's md5 sum
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
You can’t perform that action at this time.