Skip to content

Instantly share code, notes, and snippets.

@mikej312
Last active May 21, 2025 23:34
Show Gist options
  • Save mikej312/1cbbcfe05bf91acd3c42a9c79fae8891 to your computer and use it in GitHub Desktop.
Save mikej312/1cbbcfe05bf91acd3c42a9c79fae8891 to your computer and use it in GitHub Desktop.
"Fixing" Bandcamp names

The archives are named <artist> - <album>.zip. After extracting into a folder with the same name, less the extension, I want to remove the artist name. Also, if " - " appears in the album title I only want to remove the first instance after the artist name:

Rename the folders: ls -d */ | awk -F'#' '{orig = $0; sub(/ - /, "#"); system("mv \"" orig "\" \"" $2 "\"")}'

The sound files are named <artist> - <album> - <track number> <track name>. I like to the tracks to follow the format <track number> - <track name>:

Rename the files: ls | grep flac | awk '{idx = match($0, " - [0-9][0-9]"); title = substr($0, idx + 3); sub(/ /, " - ", title); system("mv \"" $0 "\" \"" title "\"")}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment