Find number of files in multiple subfolders with specific extension
Show older comments
Hello,
I have multiple sub folders in one main folder. These multiple sub folders contains files with the same extension .pgm. How do I go about finding the total number of files in all the subfolders with that specific extension?
I am trying the following:
x = '*.pgm';
AA = size(dir(x),1)
How do I then go through each subfolders?
Answers (1)
Image Analyst
on 11 Nov 2016
1 vote
dir() can now look inside subfolders if you use two asterisks . See the help.
2 Comments
monkey_matlab
on 11 Nov 2016
Image Analyst
on 11 Nov 2016
You didn't use it correctly. Check the help again. See my attached demo for how to use it.
Categories
Find more on File Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!