Skip to content

Instantly share code, notes, and snippets.

@godDLL
Last active December 20, 2015 00:49
Show Gist options
  • Save godDLL/6044957 to your computer and use it in GitHub Desktop.
Save godDLL/6044957 to your computer and use it in GitHub Desktop.
MP3 shuffling script meant for use with portable players that lack the capability, like the Mighty DWARF. Place in a folder with all your MP3s to shuffle, and they will get renamed pretty randomly. Can be launched multiple times, ignores files with *.command extension, ignores subfolder contents (renames subfolders, could be used for "album shuf…
#!/usr/bin/env bash
# mp3 shuffling script for portable players that lack it
# put in a folder with target files, they will be renamed
cd "$(dirname "$0")"
D=$(date "+%s")
for N in *; do
test "${N##*.}" = "command" && continue # don't rename our script
X=$(md5<<< "$D$N").${N##*.}
test -f "$N" && test -f "$X" || (mv "$N" "$X" && echo mv "$N" "$X")
done
echo "Press ENTER to close..."
read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment