Get the usable space : File « JDK 6 « Java

Get the usable space



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

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


Related examples in the same category

1.List all roots
2.Getting a Proper URL from a File Object
3.Get the free space
4.Get the total space
5.File Class Enhancements
6.Creates a file and sets it to read-only.
7.Create a file and change its attribute to readonly