• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to get permanant drives

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi =)

I'm trying to get the permanent available drives on a pc. Its easy enough to get all the drives available but is there a way to only get the drive that are consistent? For example i want it to ignore all network, cd/dvd and floppy drives.

Any idea's how i could solve this?

Here is my current code:



I get the following result:

C:\ //Local Drive
D:\ //Compact Disc
E:\ //Local Drive
F:\ //Removable Hard-drive
G:\ //Network Drive
H:\ //Compact Disc
V:\ //Network Drive
X:\ //Network Drive
Y:\ //Network Drive

The result i need:

C:\
E:\

Thanks
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without using JNI there is one class I know that may help you out: FileSystemView.
Unfortunately, except for floppy drives these "is" methods do not return anything useful; on my system, they all return the same values. The type may be of use but I doubt that it is a portable solution - on a different system the labels may be different, or the method may even return null.
 
Lila Fowler
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks =) , gonna try the type. - see what it will do on linux/mac
 
I once met a man from Nantucket. He had a tiny ad
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic