jeudi 25 décembre 2014

Search for .mp3 files in main folder and subfolders

im looking to make a web player from scratch so I can control my music from my phone. I've got a listing of all files within a folder done, but I need to get it to list the files within the subfolders of the main folder.


So sort of something like \Path\ - Shows all in \Path\ and \Path\subs\ shows the contents of all subfolders.


This is the code that I have written to allow me to search a folder for .mp3 files, but I cannot pin the way to search in subfolders as well.



$.ajax({
url: "music/",
success: function(data){
$(data).find("a:contains(.mp3)").each(function(){
var files = $(this).text().replace(/ /g, '');
files = $(this).text().replace(/.mp3/,'');
$('<p></p>').html(files).appendTo('#displayer');
$('#displayer > p:nth-child(odd)').css('background-color','#DDD');
});
}
});


Many thanks in advance





Aucun commentaire:

Enregistrer un commentaire