Solved

Java and Drive Space

Posted on 2004-10-20
8
219 Views
Last Modified: 2010-03-31
Is there anyway to find out the size of a disk and free space on the drive?

I have seen some examples of how to do this by creating temp files on the drive ( I though this was a bit bad )
Does anyone know if it can be done?

Thanks
0
Comment
Question by:ice_nin
8 Comments
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
You could execute a dir command (windows) and parse the output
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
You could

Runtime.getRuntime().exec.("cmd.exe /C dir");
0
 
LVL 24

Expert Comment

by:sciuriware
Comment Utility
Restriction: an empty disk returns an error message so the parsing gets complex.
I wonder why getenv() finally is incorporated into JAVA 5 and something universal like this is not.
;JOOP!
0
 

Author Comment

by:ice_nin
Comment Utility
is there not a universal way of checking, because my application is going to be run over several platforms ( not just windows )
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 37

Accepted Solution

by:
zzynx earned 125 total points
Comment Utility
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
http://www.tolstoy.com/samizdat/jconfig.html
This indicates it IS possible (but maybe not that straightforward ;°)
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
:)
0
 

Author Comment

by:ice_nin
Comment Utility
Thanks for all the help
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now