mirror of
https://github.com/junguler/m3u-radio-music-playlists.git
synced 2024-11-11 01:10:27 +00:00
16 lines
646 B
Bash
Executable File
16 lines
646 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# combine all files
|
|
for i in $(find . -type f -name "*.m3u") ; do (cat "${i}"; echo) | grep -v "#EXTM3U" >> $(basename $i) ; done
|
|
|
|
# convert all file names to lower case
|
|
for F in * ; do NEWNAME=$(echo "$F" | tr '[:upper:]' '[:lower:]') ; mv "$F" "$NEWNAME" ; done
|
|
|
|
# put all files into folders starting with the first character in their names
|
|
for i in *.m3u ; do dir=$(echo $i | cut -c 1 -) ; mkdir -p $dir ; mv $i $dir ; done
|
|
|
|
# add back "#EXTM3U" to files
|
|
for i in $(find . -type f -name "*.m3u") ; do sed -i '1s/^/#EXTM3U\n/' $i ; done
|
|
|
|
# remove empty lines
|
|
for i in $(find . -type f -name "*.m3u") ; do sed -i '/^$/d' $i ; done |