Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disk space checking

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic