File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Need some help with the following coding 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 "Need some help with the following coding" Watch "Need some help with the following coding" New topic
Author

Need some help with the following coding

Dan Czarnecki
Greenhorn

Joined: Mar 07, 2012
Posts: 11
Hello again everyone!

It's been awhile since I've been here!

I have a problem with my directory processor class that I cannot figure out how to fix it.

Below is my code:


The problem I'm having is that when displaying the number of files in a directory and the total directory size, they just show up as zeros.

Anyone know what I should do to get this working?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
You're creating a new DirectoryStatistics object for each file instead of just a single one.


Ping & DNS - updated with new look and Ping home screen widget
Dan Czarnecki
Greenhorn

Joined: Mar 07, 2012
Posts: 11
Ulf Dittmer wrote:You're creating a new DirectoryStatistics object for each file instead of just a single one.


Ok. Since you're saying I should just just be creating a single DirectoryStatistics object for the directory itself instead for each file in the directory, how would I go about doing that?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Possibly by creating it in the main method, and then passing it to DirectorySize as a parameter of the constructor.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need some help with the following coding
 
Similar Threads
How to make a file explore
How to use multiple threads to speed processing
n-dimensioned array in Java
split a file to original files