Skip to content

Instantly share code, notes, and snippets.

@kageru
Last active February 15, 2018 17:41
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 kageru/57160cfa7e1baa33f69bbe942b44b51b to your computer and use it in GitHub Desktop.
Save kageru/57160cfa7e1baa33f69bbe942b44b51b to your computer and use it in GitHub Desktop.
A simple script to move/rename a file/folder and change m3u playlist entries accordingly. Portmanteau of mv and m3u
#!/bin/bash
# Move/rename a file/folder and change all m3u playlists in $playlists accordingly
# Usage:
# $ mv3u old_filename "new filename"
# change this
playlists='/path/to/your/playlists'
src="$1"
dst="$2"
mv "$src" "$dst"
perl -p -i -e "s?\Q$src\E?$dst?" $playlists/*.m3u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment