Skip to content

Instantly share code, notes, and snippets.

@denzuko
Forked from anonymous/renamemp3
Last active December 24, 2015 18:59
Show Gist options
  • Select an option

  • Save denzuko/6847188 to your computer and use it in GitHub Desktop.

Select an option

Save denzuko/6847188 to your computer and use it in GitHub Desktop.
#!/bin/bash
###############################################################################
#
# renamemp3 - Version 1.0
# Copyrighted (c)2013 Dwight Spencer (@denzuko) <[email protected]>
# All Rights Reserved. Licenced under OSI MIT licence.
#
# renames files in a directory given by parameters to append '.mp3'
#
###############################################################################
usage() {
echo "${0} [directory] <regex>"
return 0
}
rename_mp3() {
find "${1:.}" -type f -name "${2:*}" -print0 | xargs -0 -P4 -I{} mv {} {}.mp3
}
alias main=rename_mp3
[[ -z $@ ]] && usage || main $*
###############################################################################
# vim: syntax=sh
@denzuko
Copy link
Copy Markdown
Author

denzuko commented Oct 5, 2013

Added safety messures.

@denzuko
Copy link
Copy Markdown
Author

denzuko commented Oct 5, 2013

Updated to work as a library

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