Accessing multiple folders and extracting specific image files

7 views (last 30 days)
dipon roy
dipon roy on 4 Oct 2021
Answered: Image Analyst on 7 Oct 2021
I have 15 folders and in each of them I have 997 sub-folders.In these subfolders I have multiple folders containing .png image folders and the .jpeg of those images. I want to extract specific .png files that has the name ending with '_out' in the jpeg.

Answers (3)


Walter Roberson
Walter Roberson on 7 Oct 2021
projectdir = 'path/to/place/with/15/folders';
dinfo = dir( fullfile(projectdir, '**', '*_out.png') );
fullnames = fullfile({dinfo.folder}, {dinfo.name});
fullnames will now be a cell array of character vectors naming all the png files that end with '_out' .
You did not give any information about what you might mean by "extract" for this purpose

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by