Computer Science Canada Scanning a Directory |
Author: | Prince Pwn [ Sun Feb 04, 2007 12:05 am ] |
Post subject: | Scanning a Directory |
I'm working on a Music Player and when you execute it, I want a main directory (such as c:/.../my music/) and it goes through all folders within that main directory and store each .mp3 inside an array (or a file). eg: ---C:/Music/ -------------/Greenday/ -------------------------American Idiot.mp3 -------------------------Jesus of Suburbia.mp3 #don't know how to return to main folder & continue scanning ------------/Black Eyed Peas/ -------------------------My Humps.mp3 -----------/The Vapors/ -------------------------Turning Japanese.mp3 The trouble I am having is once inside a folder, returning to the main folder and continue scanning all of them until the bottom. I've been trying to do this for a few months now and cannot get it right. Could anyone assist me in this? It is not for a school project because we're done with Turing and moving onto Java in grade 12 and I "passed Turing" lol. Thanks. |
Author: | rdrake [ Sun Feb 04, 2007 1:25 am ] |
Post subject: | RE:Scanning a Directory |
Not sure if this helps or not, but "../" points to the parent directory. |
Author: | Prince Pwn [ Sun Feb 04, 2007 2:55 pm ] | ||
Post subject: | Re: Scanning a Directory | ||
Here is directly from the Turing help:
I know how to do the above, it's just I need help with making an if statement that will know if it's a file or a directory (tried Dir.Exists but wasn't working) then opening that file and scan it then go back ".." or "." and go to the next folder. |
Author: | ericfourfour [ Sun Feb 04, 2007 11:40 pm ] | ||||
Post subject: | Re: Scanning a Directory | ||||
I made a function that returns a linked list of the filenames.
A sample program:
|