Skip to content

Instantly share code, notes, and snippets.

@Eddy-Barraud
Created May 16, 2018 15:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eddy-Barraud/54f386fe8edc18b4832f1e52be14c695 to your computer and use it in GitHub Desktop.
Save Eddy-Barraud/54f386fe8edc18b4832f1e52be14c695 to your computer and use it in GitHub Desktop.
Create a Playlist of every songs inside every folders present at current directory
#!/bin/bash
#
# bash script to create playlist files in music subdirectories
# This one will aggregate every sonds inside only one same playlist
# Steve Carlson (stevengcarlson@gmail.com)
rm -f all.m3u
find . -type d |
while read subdir
do
# rm -f "$subdir"/*.m3u
for filename in "$subdir"/*
do
if [[ ${filename##*.} =~ m4a|mp3|ogg|aac|wav|wma ]]
then
#echo "${filename##*/}" >> ./"$subdir"/"${subdir##*/}.m3u"
echo "${subdir##*/}/${filename##*/}" >> ./all.m3u
fi
done
done
#!/bin/bash
#
# bash script to create playlist files in music subdirectories
#
# Steve Carlson (stevengcarlson@gmail.com)
rm -f *.m3u
find . -type d |
while read subdir
do
rm -f "$subdir"/*.m3u
for filename in "$subdir"/*
do
if [[ ${filename##*.} =~ m4a|mp3|ogg|aac|wav|wma ]]
then
echo "${filename##*/}" >> ./"$subdir"/"${subdir##*/}.m3u"
echo "${subdir##*/}/${filename##*/}" >> ./"${subdir##*/}.m3u"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment