Solved

Java and Drive Space

Posted on 2004-10-20
8
220 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
ID: 12359602
You could execute a dir command (windows) and parse the output
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12359604
You could

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

Expert Comment

by:sciuriware
ID: 12360645
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
ID: 12443491
is there not a universal way of checking, because my application is going to be run over several platforms ( not just windows )
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

Accepted Solution

by:
zzynx earned 125 total points
ID: 12443609
0
 
LVL 37

Expert Comment

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

Expert Comment

by:zzynx
ID: 12443784
:)
0
 

Author Comment

by:ice_nin
ID: 12443789
Thanks for all the help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

864 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

21 Experts available now in Live!

Get 1:1 Help Now