• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file parsing in drive (how many drives )

 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stuart Gray
i need a code which o/p c:\ or d:\ howmany drives
Thanks,
gowtham
 
Ganesh Gowtham
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic