15 Jul 2013, 00:00

Linux – Bash Script to Randomly Rename Files In Current Directory

This version uses the whole sha1sum:

#!/usr/bin/sh
for fname in *.mp3;
do
mv "$fname" $(echo "$fname" | sha1sum | cut -f1 -d' ').mp3
done

This version uses only the first 8 characters of the sha1sum (WARNING: might overwrite files)

#!/usr/bin/sh
for fname in *.mp3;
do
mv "$fname" $(echo "$fname" | sha1sum | cut -b -8).mp3
done