osx - script for auto opening directories (mac os x) and creating m3u playlists -


imagine have directories containing both mp3 files , sub-directories, containing mp3 files, like:

/music/band1/ /music/band2/ /music/band2/dir1/ /music/band2/dir2/ /music/band3/dir1/ /music/band3/dir2/ /music/band4/ ... 

i create .m3u file in every directory containing mp3 files - example:

/music/band1/band1.m3u /music/band2/band2.m3u /music/band2/dir1/dir1.m3u /music/band2/dir2/dir2.m3u /music/band3/dir1/dir1.m3u /music/band3/dir2/dir2.m3u /music/band4/band4.m3u 

the name of .m3u file directory name in .m3u created. (this example directory structure.)

i hope clear :)

so far have generate m3u files *.mp3 files, in actual directory, , name directory.

#!/bin/bash\ ls | grep -i mp3 > filelist.txt mv filelist.txt filelist.m3u foldername=${pwd##*/} echo $foldername mv filelist.m3u $foldername.m3u 

what should added have recursively every subdirectory of /music, , if there sub-sub directory, there? then, execute m3u-making script in each sub-directory?

thank help! :)

this should take care of whole thing (no need script).

find . -name '*.mp3' -execdir bash -c 'file="{}"; printf "%s\n" "${file##*/}" >> "${pwd##*/}.m3u"' \; 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -