Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Learn JDK 6 ===> " File (List all roots) "

  Asked By: Darcy    Date: Jul 12    Category: Java    Views: 869
  

import java.io.File;

public class SpaceChecker {
public static void main(String[] args) {
File[] roots = File.listRoots();

for (int i = 0; i < roots.length; i++) {
System.out.println(roots[i]);
System.out.println("Free space = " + roots[i].getFreeSpace());
System.out.println("Usable space = " + roots[i].getUsableSpace());
System.out.println("Total space = " + roots[i].getTotalSpace());
System.out.println();
}
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Learn JDK 6 ===> " File (List all roots) " Or get search suggestion and latest updates.




Tagged: