How can we distinguish System drives and external storage devices?

hello,

How can we detect the system drives and virtual drives? How can we distinguish between them? Using File.listRoots() method, we can get all the roots, but out of them how can we know which one is connected externally or through USB? Is there any other way? Please If you have knowledge about this, guide me.

Regards

Nikhil

[353 byte] By [nikhil_shravanea] at [2007-11-26 16:31:50]
# 1
You can't do that AFAIK.Kaj
kajbja at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...
# 2
The point of the whole shebang is that you don't have to differ between them. You can get minimal information (namely "isFloppyDrive") from FileSystemView.
CeciNEstPasUnProgrammeura at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...
# 3

thanx kaj,

If I execute my application first and then connect any storage USB device, application detects the newly connected device.

But, If the device is already connected, and then I start my application, It fails to detect the connected device.

I am using File.listRoots() method, which lists all the currently available roots, roots may be system drives or connected USB drive. this will clear the idea.

If you know any other way or atleast idea please tell me.

Regards

Nikhil

nikhil_shravanea at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...
# 4
thanx CeciNEstPasUnProgrammeur yes, I'll get back to you after reading docs on FileSystemView, thanx very much for now.Regards and take careNikhi
nikhil_shravanea at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...
# 5

Hello CeciNEstPasUnProgrammeur

I studied and implemented some of methods in the class FileSystemView. This is really helpfull to me, I have sorted out my problem. Thanks a lot.

Following example code snippet prints distinguishing characters:-

import java.io.*;

import javax.swing.filechooser.FileSystemView;

public class TryVirtualDrive

{

public static void main (String args[])

{

File[] roots = File.listRoots();

for(int i=0; i< roots.length; i++)

{

System.out.println(FileSystemView.getFileSystemView().getSystemTypeDescription(roots));

System.out.println(FileSystemView.getFileSystemView().getSystemDisplayName(roots));

System.out.println();

}

}

}

Regards

Nikhi Shravane

nikhil_shravanea at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...
# 6
Sorry for repeated posting!!
nikhil_shravanea at 2007-7-8 22:56:23 > top of Java-index,Java Essentials,Java Programming...