Below java code show how to get the list of file system root –
/****************************************************************************************
* Created on 04-2012 Copyright(c) https://kodehelp.com All Rights Reserved.
****************************************************************************************/
package com.kodehelp.javaio;
import java.io.File;
/**
* Created by https://kodehelp.com Date: 4/6/12
*/
public class ListFileSystemRoot {
public static void main(String[] args) {
File[] listOfRoot = File.listRoots();
for (int i = 0; i < listOfRoot.length; i++) {
File root = listOfRoot[i];
System.out.println("Root " + (i + 1) + "/" + listOfRoot.length +
" Of your File System = " + root.getAbsolutePath());
}
}
}