Sunday, 15 November 2015

Checking Disk Space using Java program

With this code you can check Disk Space.

/** To Check the Disk Space **/
package in.blogspot.java2bigdata;

import java.io.File;
public class DiskSpaceCheck {
public DiskSpaceCheck() {
File file = new File("E:");
System.out.println("E:");
System.out.println("Total:  " + file.getTotalSpace());
System.out.println("Free:   " + file.getFreeSpace());
System.out.println("Usable: " + file.getUsableSpace());
file = new File("E://movie");
System.out.println("E://movie");
System.out.println("Total:  " + file.getTotalSpace());
System.out.println("Free:   " + file.getFreeSpace());
System.out.println("Usable: " + file.getUsableSpace());
file = new File("/");
System.out.println("n/");
System.out.println("Total:  " + file.getTotalSpace());
System.out.println("Free:   " + file.getFreeSpace());
System.out.println("Usable: " + file.getUsableSpace());
}
public static void main(String[] args) {
new DiskSpaceCheck();
}
}

Java Program to List Contents of Directory in Hadoop (HDFS)

No comments:

Post a Comment