is it possible to find the available logical drives? if so...how?

Recommended Answers

All 4 Replies

Read the API for File, namely the method listRoots.

I think that File method listRoots() is your best shot. However I have no idea how this work if you have dual booting system in combinanion windows and unix

thx! I`ve been google`ing and going over the File functions (except this one) for over an hour..

File []drives = new File("").listRoots();
for(int j=0;j<drives.length;j++)
	System.out.println(drives[j]);

You don't even need the new File("") part - the method is static.

for(File drive : File.listRoots() )
    System.out.println(drive);

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.