CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    29

    How to find local systems free space?

    Hi all,

    Can any one tell me, how to find C: free space in windows using java?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How to find local systems free space?

    Code:
    File disk = new File("c:");
    System.out.println("disk.getTotalSpace() = " + disk.getTotalSpace());
    System.out.println("disk.getFreeSpace() = " + disk.getFreeSpace());
    System.out.println("disk.getUsableSpace() = " + disk.getUsableSpace());
    Read the API docs for the methods to get full details.

    The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents...
    N. Borenstein
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Sep 2008
    Posts
    29

    Thumbs up Re: How to find local systems free space?

    hi dlorde,
    its working fine. Thanks for ur kind reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured