Java Disk Free Space Get getFreeSpace(String dir)

Here you can find the source of getFreeSpace(String dir)

Description

Returns the free disk space on the partition storing the given directory.

License

BSD License

Parameter

Parameter Description
dir the directory stored in the partition

Return

the free disk space

Declaration

public static long getFreeSpace(String dir) 

Method Source Code


//package com.java2s;
/*//from www  .java 2s.c o m
 * Copyright (c) 2008-2011 by Bjoern Kolbeck, Jan Stender,
 *               Felix Langner, Zuse Institute Berlin
 *
 * Licensed under the BSD License, see LICENSE file for details.
 *
 */

import java.io.File;

public class Main {
    /**
     * Returns the free disk space on the partition storing the given directory.
     *
     * @param dir
     *            the directory stored in the partition
     * @return the free disk space
     */
    public static long getFreeSpace(String dir) {
        return new File(dir).getFreeSpace();
    }
}

Related

  1. getFreeSpace(File directory)
  2. getFreeSpace(File file)
  3. getFreeSpace(String pathname)
  4. getFreeSpaceOnPartition(File f)
  5. getTreeSize(File root)
  6. getTreeSize(File root)