Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Computer Disk Space Java
01-17-2010, 02:57 PM (This post was last modified: 01-17-2010 02:59 PM by codecaine.)
Post: #1
Computer Disk Space Java
Code:
import java.io.File;

public class Main {

    public static void main(String[] args) {
        
        File diskInfo = new File("/"); //drive path you want to measure
        System.out.println("Total Free Space: " + diskInfo.getFreeSpace() + " bytes");
        System.out.println("Total Disk Space: " + diskInfo.getTotalSpace() + " bytes");
        System.out.println("Total Usable Space: " + diskInfo.getUsableSpace() + " bytes");
    }
}
Visit this user's website Find all posts by this user
Quote this message in a reply
01-17-2010, 06:46 PM
Post: #2
RE: Computer Disk Space Java
Great use of diskInfo property. Other languages have those options too.

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
01-17-2010, 08:59 PM
Post: #3
RE: Computer Disk Space Java
Hey nice code Smile
Find all posts by this user
Quote this message in a reply
01-18-2010, 01:35 AM
Post: #4
RE: Computer Disk Space Java
(01-17-2010 06:46 PM)drdebcol Wrote:  Great use of diskInfo property. Other languages have those options too.

It's the File class diskInfo is just the variable name I gave it.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: