This JAVA code gives the dpace usage by the 'c:' drive you can modify it for others.
Code:
Code:
package com.oksbwn.systeminteraction;
import java.io.File;
public class DiskSpaceDetail
{
public String FreeSpaceInDrive()
{
String space="";
File file = new File("C:");
long totalSpace = file.getTotalSpace(); //total disk space in bytes.
long usableSpace = file.getUsableSpace(); ///unallocated / free disk space in bytes.
space=space+"C:";
space="T: "+ totalSpace /1024 /1024 + " MB F: "+ usableSpace /1024 /1024+" MB";
return space;
}
}
No comments:
Post a Comment