• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Counting number of files in each folder

 
Rodricks george
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Rodricks george
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much sir.
-Rodricks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic