How to list out all system drives in your system
Written on January 16, 2010 at 9:39 am by
mkyong
File.listRoots() will list out all the available file system roots / drives in your current system.
Example
package com.mkyong.io; import java.io.File; public class App{ public static void main (String args[]) { File[] rootDrive = File.listRoots(); for(File sysDrive : rootDrive){ System.out.println("Drive : " + sysDrive); } } }
Output
Drive : A:\ Drive : C:\ Drive : D:\ Drive : E:\
Oracle Magazine (Free)
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation


