September 04, 2010, 02:10:55 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Java 1.6 file class get the free space of the disk  (Read 2898 times)
0 Members and 1 Guest are viewing this topic.
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« on: August 17, 2008, 03:33:31 PM »

Java 1.6 introduced the getFreeSpace() method that shows the remaining disk space in bytes. For those that want to know how to get the unallocated  disk space I've written a demo here (sourcecode included)
http://www.engineeringser...8/17/java-free-diskspace/

Quote
getFreeSpace()
Returns the number of unallocated bytes in the partition named by this abstract path name.

Output:
Java free diskspace demo
c:\ 111,79 Gb total 13,39 Gb left
d:\ 0,00 Gb total 0,00 Gb left
e:\ 0,00 Gb total 0,00 Gb left
f:\ 0,00 Gb total 0,00 Gb left
g:\ 0,00 Gb total 0,00 Gb left
h:\ 0,48 Gb total 0,01 Gb left
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net :: a community about Java software development.
« on: August 17, 2008, 03:33:31 PM »

Your Ad Here
 Logged
jurka
Staff
Member
*
*

Reputation: 5
Offline Offline
Posts: 188
Referrals: 0

Awards
« Reply #1 on: August 18, 2008, 02:11:22 AM »

It is platform independent ? Like i could use it in Linux, Mac or somewhere else?
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #2 on: August 18, 2008, 09:16:44 AM »

It is platform independent ? Like i could use it in Linux, Mac or somewhere else?

Yes it should work because i haven't made any platform specific calls. The methods that i use are all available in the JRE/SDK 1.6
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
gluk
Member
*

Reputation: 0
Offline Offline
Posts: 22
Referrals: 0

Awards
« Reply #3 on: April 21, 2009, 05:50:40 PM »

The solution for most of the Java related errors can be found at this site: Java errors and solutions.
« Last Edit: April 22, 2009, 12:44:08 PM by HappyFace » Logged
Javaforums.net :: a community about Java software development.
   

Your Ad Here
 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.261 seconds with 37 queries.

Google visited last this page Yesterday at 07:19:11 AM