Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,158,706 members, 7,837,585 topics. Date: Thursday, 23 May 2024 at 07:42 AM

Urgent Help With Directories In Java. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Urgent Help With Directories In Java. (1002 Views)

Problem With Bufferedinputstream Read Blocking Issue In Java / I Want To Develop A Software In Java To Calculate CGPA / How Do Io Create Ribbon Ui In Java (2) (3) (4)

(1) (Reply) (Go Down)

Urgent Help With Directories In Java. by Nov1ce(m): 2:02pm On Jun 27, 2011
Hey,
am working of an app and part or the funtionality is that it should be able to list all files on your drive (I'll do the file filter myself).
amd I need help with that regard.
The main thing is that it should transverse directories and sub directories in that directory and so on until it gets to a point where there are not more sub directories. Am using Java. This is really urgent.
Re: Urgent Help With Directories In Java. by Fayimora(m): 2:19pm On Jun 27, 2011
Before i start explaining some long shit, do you have some code down already that doesn't work as it would be easier and faster to help in that case, else would just go on with the explanation
Re: Urgent Help With Directories In Java. by SayoMarvel(m): 5:25pm On Jun 27, 2011
@Fayimora Good one there.
@Poster What do you have on ground? That way, it will be easier to help. But then, there is a list() method buried somewhere in the I/O API, and there is another method to list the root drives on the file system. I won't spoon feed you so go and dig through the API documentation for the java.io package. The find feature in your browser will make it easier, trust me.
Re: Urgent Help With Directories In Java. by wassolldas: 5:41pm On Jun 27, 2011
API: http://www.oracle.com/technetwork/java/javase/documentation/api-jsp-136079.html

For java 6 at http://download.oracle.com/javase/6/docs/api/
java.io.File
- isDirectory method tells you if the path is a directory or not.
- isFile method tells you if the path is a file.

- list method - Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.
- listFiles - Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.


Refer to the API and write the code to do what you need.
Re: Urgent Help With Directories In Java. by Shimao(m): 6:51pm On Jun 27, 2011
You've been given all you need but just to add, you might need to add some recursive code and you might as well check up the Composite design pattern.

(1) (Reply)

Best Combination / [Help Request] I Need Your Help With Some Python Programing Questions. / Difference Btw Software Development Approach And SW Devt Methodology

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.