This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Disk space checking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Disk space checking" Watch "Disk space checking" New topic

Disk space checking

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I am opening few files, and after some string manipulation, concatenating them into one .txt file and write it to a output file. I would like to know whether there is any way to check the disk space available in the output directory before I store the output file and give proper info to the user whether the file is saved or not. How do I check the disc space available in the output directory. How to handle such scenario? Thanks.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904


this ll help..

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Take a look at the File class' getFreeSpace() and getUsableSpace() methods. Note that these were added in Java 6, so they are not available in earlier versions.
[ April 04, 2008: Message edited by: Mark Vedder ]
I agree. Here's the link:
subject: Disk space checking
It's not a secret anymore!