Skip to content

Instantly share code, notes, and snippets.

@paunin
Last active August 29, 2015 14:05
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 paunin/1d3150b5a530691c1a9b to your computer and use it in GitHub Desktop.
Save paunin/1d3150b5a530691c1a9b to your computer and use it in GitHub Desktop.
#!/bin/bash
#Simple playlist generator m3u
#@author paunin
OLDIFS=$IFS
IFS=$'\n'
rm -rf playlists
mkdir playlists
find $1 -maxdepth 1 -type d | while read dir
do
#echo $dir
plist=$(basename "$dir")
echo "Create playlist - $plist"
find -E $dir -regex '.*\.(mp3|alac)$' | while read file
do
echo "Add $file to $plist"
echo "$file" >> "./playlists/$plist.m3u"
done
find -E
done
IFS=$OLDIFS
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment