I have a very simple question.
How do I go to the number of system-driven drives?
Also, how can I determine whether they are HDDs, SSDs, or USB?
There is no system-independent way to tell the difference between HDD and SDD, Can guess by name. The best you can use FileSystemView:
file [] path; FileSystemView fsv = FileSystemView.getFileSystemView (); Returns pathnames for files and directory paths = File.listRoots (); // path path for each path name (file path: path) {// print file and directory path System.out.println ("drive name:" + path); System.out.println ("Description:" + fsv.getSystemTypeDescription (Path)); System.out.println ("Type:" + fsv.getSystemTypeDescription (Path)); System.out.println ("Drive Is?" + Fsv.isDrive (Path)); }
No comments:
Post a Comment