aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
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: 225

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: 225

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: 225

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: 225

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://aspose.com/file-tools
 
subject: file parsing in drive (how many drives )