This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes file parsing in drive (how many drives ) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "file parsing in drive (how many drives )" Watch "file parsing in drive (how many drives )" New topic
Author

file parsing in drive (how many drives )

Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 223

Hi All,

could u guys suggest s for below criteria ?.

i need to parse all files in my hard disk.
As of now i can able to parse the specific drive , which i am giving explicitly in my code in my file object .

all i need a code to get how many drives .Since place where my code executes , i cant able to pre think how many drives are there?.

Please suggest a idea or link

Thanks ,
gowtham
grgowtham_cse@yahoo.com
eprosoft Inc
NJ


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
The listRoots() method in the File class returns all available roots on the system as an array of File instances. Note that these might not necessarily be physical drives though (they might be networked drives etc).
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 223

Originally posted by Stuart Gray:
The listRoots() method in the File class returns all available roots on the system as an array of File instances. Note that these might not necessarily be physical drives though (they might be networked drives etc).


Could u Pls find where i am going wrong




Thanks ,
gowtham
grgowtham_cse@yahoo.com
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 223

Stuart Gray
i need a code which o/p c:\ or d:\ howmany drives
Thanks,
gowtham
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 223

Oops finally ...

public static void main(String args[])
{
File list[] = File.listRoots();
for (int i = 0; i < list.length; i++) {

System.out.println("not accessible:"
+ list[i]);
}

This does my Work.
Thanks
Gowtham
grgowtham_cse@yahoo.com
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: file parsing in drive (how many drives )
 
Similar Threads
Adding new disk drive
Get the CD-rom drives
Get detail of all drives(including external discs) having specific files
URLy Bird: database location
How to get permanant drives