aspose file tools*
The moose likes Beginning Java and the fly likes list of files in a directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "list of files in a directory" Watch "list of files in a directory" New topic
Author

list of files in a directory

geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
guys just confused aboout one thing...when i m using the list() while searching then shouldn't it display all the files in the directory and its subdirectories?
i know its a simple quest but still i am revolving around thid...please help!
thanks
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

No you will only see the files and folders inside the filepath you are in.

File API - public String[] list()

Returns:
An array of strings naming the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.


Regards, Rene Larsen
Dropbox Invite
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19695
    
  20

If you need the files of the sub directories as well you will need to call list() on all the sub directories as well, and on its sub directories, etc.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
thanks guys!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: list of files in a directory