Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes How to check file size on disk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to check file size on disk" Watch "How to check file size on disk" New topic
Author

How to check file size on disk

scott Edwards
Greenhorn

Joined: Jul 25, 2003
Posts: 6
I need to check the size that a file occupies on disk, not the actual file size.
Could somebody please help me out?
Thanks a lot.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Meaning the size of the allocation blocks dedicated to the file, I presume.
I don't think there's any way to do this from Java.


[Jess in Action][AskingGoodQuestions]
scott Edwards
Greenhorn

Joined: Jul 25, 2003
Posts: 6
Yes, I mean
the size of the allocation blocks dedicated to the file.
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
In Java there is nothing to do with hadware or Operating System. You can only find the No. of bytes in a File not in terms of disk space.
The only way is to write Operating System Specific code (in C Language)to find out the file size and access the code using JNI from Java.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check file size on disk
 
Similar Threads
Can not converte jad to prc files
Reg. File Upload
Size of a empty class
Problem with File Upload
java mail excel attachment problem