Skip to content

Instantly share code, notes, and snippets.

@wolkenschieber
Created March 9, 2019 16:42
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 wolkenschieber/84f5fcd9b71cac01f88ce05319bdfe74 to your computer and use it in GitHub Desktop.
Save wolkenschieber/84f5fcd9b71cac01f88ce05319bdfe74 to your computer and use it in GitHub Desktop.
Recursivly sanitize MP3-filenames
#!/usr/bin/env bash
for mp3file in **/*.mp3; do DIR=$(dirname "${mp3file}"); BASENAME=$(basename "${mp3file}"); SANINAME=$(echo "${BASENAME}" | sed -e 's/[^A-Za-z0-9._-]/_/g'); mv "${mp3file}" "${DIR}/${SANINAME}";done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment