aspose file tools*
The moose likes Beginning Java and the fly likes Find File Size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Find File Size" Watch "Find File Size" New topic
Author

Find File Size

Natesan Prabhakaran
Ranch Hand

Joined: Jul 11, 2006
Posts: 47
hi..

I need to find .pdf and .eps(encapsulated post script) file size but i cant., can you anyone help me.

thanks
Prabhakaran.N


Regards,
Prabhakaran.N
Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
Hi
If you have the file name, then you can check the possibilities of the 'File ' class.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

length() method of File Class is return the file size in bytes.
See Java Doc for more clarification. or try google for it. you'll definitely find some example on it.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Natesan Prabhakaran
Ranch Hand

Joined: Jul 11, 2006
Posts: 47
hi..thanks for reply.,

all "File" related funtions tell about lengh of file like

System.out.println("File size = " +new
File("D:\\NPrabhakaran\\Important.doc").length());
Natesan Prabhakaran
Ranch Hand

Joined: Jul 11, 2006
Posts: 47
hi Saif,

but it is not working for .pdf and .eps files.

thanks.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Natesan Prabhakaran:
but it is not working for .pdf and .eps files.


try this code..



I have checked this code in my machine and it works fine.
[ September 05, 2007: Message edited by: Saif uddin ]
Natesan Prabhakaran
Ranch Hand

Joined: Jul 11, 2006
Posts: 47
yes Saif,
thank you., now i got.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Find File Size