Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Last active August 29, 2015 14:00
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 shichao-an/11239784 to your computer and use it in GitHub Desktop.
Save shichao-an/11239784 to your computer and use it in GitHub Desktop.
Convert long crappy filenames of MP3 tracks
#!/bin/bash
for f in *; do ff="$(echo "$f" | sed 's/\(^.*\)\((320K)MP3\)\(.*mp3\)/\3/g')"; mv "$f" "$ff"; done
files=(*.mp3)
while read line; do lines+=("$line"); done < tracks
for i in $(seq 1 1 ${#files[@]}); do mv "${files[$i]}" "${lines[$i]}.mp3"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment