Skip to content

Instantly share code, notes, and snippets.

@mcharytoniuk
Created January 19, 2018 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcharytoniuk/c2e11e63ba76e287536ccff1f5836b16 to your computer and use it in GitHub Desktop.
Save mcharytoniuk/c2e11e63ba76e287536ccff1f5836b16 to your computer and use it in GitHub Desktop.
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