Last active
February 21, 2025 04:08
-
-
Save scarlson/944860 to your computer and use it in GitHub Desktop.
Bash script to create .m3u playlist files for all mp3s in subdirectories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# bash script to create playlist files in music subdirectories | |
# | |
# Steve Carlson ([email protected]) | |
find . -type d | | |
while read subdir | |
do | |
rm -f "$subdir"/*.m3u | |
for filename in "$subdir"/* | |
do | |
if [ ${filename: -4} == ".mp3" ] || [ ${filename: -5} == ".flac" ] || [ ${filename: -5} == ".loss" ] || [ ${filename: -5} == ".aiff" ] || [ ${filename: -4} == ".aif" ] | |
then | |
echo "${filename##*/}" >> ./"$subdir"/"${subdir##*/}.m3u" | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, Mattias
In the coming weeks, I will update my music library, and then I will try your script.
i will come back to you when I try it.