OK, what im thinking of doing is this:
Putting the directory & subdirectory contents into a .TXT file
shell_exec ( "dir c:\mp3 /s > c:\web\apache2\htdocs\output.txt" );
The output.txt looks like this:
Volume in drive C has no label.
Volume Serial Number is 244B-80F6
Directory of c:\mp3\artist1
30/04/03 17:13 <DIR> .
30/04/03 17:13 <DIR> ..
23/10/02 13:42 3,550,408 mp3_1.mp3
19/03/02 14:05 3,426,752 mp3_2.mp3
14/08/02 16:03 1,055,456 mp3_3.mp3
3 File(s) 59,036,364 bytes
Directory of c:\mp3\artist2
02/10/02 11:02 <DIR> .
02/10/02 11:02 <DIR> ..
23/10/02 13:42 3,550,408 mp3_4.mp3
19/03/02 14:05 3,426,752 mp3_5.mp3
14/08/02 16:03 1,055,456 mp3_6.mp3
3 File(s) 59,036,364 bytes
So, I need to line by line go through the text file.
Everytime I come across the 'Directory of' words, i need to store that directory in a variable.
Then I need to carry on going through the file, and every .mp3 file I will insert into a database, with the directory variable in a field, and also some MP3 information.
QUESTIONS:
How do I go through a .TXT file line by line, and when I find a 'Directory Of' words, how do I store the remainder of the line in a variable?
When I find a .MP3 extension, how would I get the preceding filename into a variable?
Thanks.