How to read folders of diferent names extensions
조회 수: 3 (최근 30일)
이전 댓글 표시
Dear all, I have folders the name of which is e.g. 000003.537, 000003.637, 000004.037. In each folder is one image file and the name of all image files is the same e.g. 000001.tiff. I am looking for the way how to take out images from all folder and copy them into new folder.
Now I do that in a simple way, that I rename all folder to e.g. 000001, 000002, 000003,... and in such a way I go around the issue with such name 000003.537.
The different name of folder and the changing extension is my problem.
I will appreciate any advice which will lead to more elegant solution. Ludek
댓글 수: 0
채택된 답변
Oleg Komarov
2012년 8월 8일
% retrieve all subfolders's names
s = dir('yourpath');
idx = [s(:).isdir];
names = {s(idx).name}';
% Remove . and ..
names = setdiff(names,{'.','..'});
Now you can loop through each names and movefile() which is inside.
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!