jQuery in Action, 2nd edition*
The moose likes I/O and Streams and the fly likes Counting number of files in each folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Counting number of files in each folder" Watch "Counting number of files in each folder" New topic
Author

Counting number of files in each folder

Rodricks george
Ranch Hand

Joined: Sep 10, 2006
Posts: 97
Dear Sir,

I am facing problem in Counting number of files in each folder. I am getting the path of all files using recursive funtion and Folder names also

For example

C:\images\barcode\3.PNG-->barcode
C:\images\barcode\4.PNG-->barcode
C:\images\barcode\5.png-->barcode
C:\images\barcode\5gif.GIF-->barcode


C:\images\images\Auro0_0.png-->images
C:\images\images\Auro0_1.png-->images
C:\images\images\Copy of Auro0_1.png-->images

C:\images\test\Auro0_0.png-->test

So i have 3 folder test , images , barcode. I want to calculate and print
test -> 1 file.
images -> 3 files.
barcode -> 4 files.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18


Always check for null on the result of listFiles, because it also returns null when an I/O error occurs, e.g. if you don't have access to the folder.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rodricks george
Ranch Hand

Joined: Sep 10, 2006
Posts: 97
Thank you so much sir.
-Rodricks
 
 
subject: Counting number of files in each folder
 
Similar Threads
Images in downloaded files
problems in executing a jar file
Reading nconvert.exe in java???????????
Pagination for Images
Where do I put images in J2me application