Skip to content

Instantly share code, notes, and snippets.

@evoknow
Last active January 13, 2021 01:36
Show Gist options
  • Save evoknow/9048e2d65685e586277179da64c5ebcc to your computer and use it in GitHub Desktop.
Save evoknow/9048e2d65685e586277179da64c5ebcc to your computer and use it in GitHub Desktop.
Shell Script to Rename MP3 Files
#!/bin/bash
# This simple script renames all the MP3 (.mp3) files in the current directory
# to myprefix_000.mp3, myprefix_001.mp3, etc.
#
# Change the "myprefix" with whatever prefix you want
#
# Mac User Group (MUG) YouTube Channel Video Reference:
# https://www.youtube.com/watch?v=YsPRMsnSBW0
#################################################################################
ls -1 *.mp3 | awk '{printf("mv \"%s\" %s_02d.mp3\n", $0, "myprefix", i++)}' | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment