Computer Science Canada Traversing Directories |
Author: | Carey [ Thu Apr 17, 2008 10:09 am ] | ||
Post subject: | Traversing Directories | ||
Im making a tagging program (like windows search on 'roids) and i need help on how to add multiple files. Turing example:
any help would be muchly appreciated |
Author: | Carey [ Fri Apr 18, 2008 11:44 am ] |
Post subject: | RE:Traversing Directories |
anyone? |
Author: | Tony [ Fri Apr 18, 2008 12:03 pm ] |
Post subject: | RE:Traversing Directories |
eh.. call addFile multiple times? It's not clear what your question is. |
Author: | Carey [ Fri Apr 18, 2008 12:15 pm ] |
Post subject: | RE:Traversing Directories |
I want to go through a directory recursively, adding every file in it and going into every directory. my problem is that i don't know how to get the names and paths of every file and sub-directory inside the initial directory passed to the method. tell me if i'm not making sense. |
Author: | Tony [ Fri Apr 18, 2008 12:36 pm ] | ||
Post subject: | RE:Traversing Directories | ||
Dir.Get returns the "next" item in the directory. If it's a file (File.Exists), you add it to the list. Otherwise you assume it's a directory, and recursively examine that. The sample code already does just this
|
Author: | Carey [ Fri Apr 18, 2008 12:40 pm ] |
Post subject: | RE:Traversing Directories |
I know that. I need help on porting this method into Java. I don't know how to get the paths and such of all the items in a directory in Java. i've searched the online help file and tutorials but i haven't found anything. I just gave the Turing example to clarify what i need to accomplish. |
Author: | Tony [ Fri Apr 18, 2008 1:37 pm ] |
Post subject: | RE:Traversing Directories |
Ohh... I haven't noticed that this was in Java. Sorry. What do Java Docs say about the File class? |
Author: | Carey [ Mon Apr 21, 2008 10:48 am ] | ||||
Post subject: | RE:Traversing Directories | ||||
hmmmmm. I think i have it
hmmmmm. doesn't seem to work. any ideas? crap. [slaps forehead] im an idiot. this is a working version:
my question now is: What is Java's definition of a [i]normal file. Is a hidden file normal? Quote: A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria.
Do these system-dependent criteria specify that it has to be visible(not hidden)? |