Java and Drive Space

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
ice_ninAsked:
Who is Participating?
 
zzynxSoftware engineerCommented:
You could execute a dir command (windows) and parse the output
0
 
CEHJCommented:
You could

Runtime.getRuntime().exec.("cmd.exe /C dir");
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
sciuriwareCommented:
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
 
ice_ninAuthor Commented:
is there not a universal way of checking, because my application is going to be run over several platforms ( not just windows )
0
 
zzynxSoftware engineerCommented:
http://www.tolstoy.com/samizdat/jconfig.html
This indicates it IS possible (but maybe not that straightforward ;°)
0
 
zzynxSoftware engineerCommented:
:)
0
 
ice_ninAuthor Commented:
Thanks for all the help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.