I am able to get free disk space. How would I get the total disk space?
My code is:
import java.io.IOException;
import org.apache.commons.io.FileSystemUtils;
public class DiskSpace {
public static void main(String[] args) {
try {
//calculate free disk space
double freeDiskSpace = FileSystemUtils.freeSpaceKb(args[0]);
System.out.println(args[0]);
//convert the number into gigabyte
double freeDiskSpaceGB = freeDiskSpace / 1024 / 1024;
System.out.println("Free Disk Space (GB):" + freeDiskSpaceGB);
} catch (IOException e) {
e.printStackTrace();
}
}
}
FileSystemUtils do not have method for total space of disk ??? hopes for your reply
Thanks in advance
try