I'm in the process of making a small intranet site for use in my home. I have ripped all our CD's to MP3's and they are pretty well organized, and i'm trying to automate loading the info I need into a SQL database.
Directory structure is like this
But some of my CD's are multiple disc sets so the structure is like this:Code:Music |----Artist - AlbumName | |--01 - SongName.mp3 |----Artist - AlbumName | |--01 - SongName.mp3 |----Etc...
Currently I have code using IO.DirectoryInfo & IO.FileInfo pulling the information, but it doesn't work when it comes to the multiple CD ones. My current code reads it to the screen correctly and my database code works perfectly for inserting. What I need is to read sub directories under the current directory. Whats the best way to do that?Code:Music Music |----Artist - AlbumName | |--01 - SongName.mp3 |----Artist - AlbumName | |--CD1 | | |--01 - SongName.mp3 | |--CD2 | | |--01 - SongName.mp3 |----Etc...
Code:Sub getDirs() Dim Dir1 As IO.DirectoryInfo = New IO.DirectoryInfo("\\pvr\c\music") Dim dirs As IO.DirectoryInfo() = Dir1.GetDirectories("*") Dim diNext As IO.DirectoryInfo Dim files As IO.FileInfo() Dim filename As IO.FileInfo For Each diNext In dirs Console.WriteLine(diNext.Name) files = diNext.GetFiles("*") For Each filename In files Console.WriteLine(" " & filename.Name) Next Console.ReadLine() Next End Sub




Reply With Quote