How to read folders of diferent names extensions

6 ビュー (過去 30 日間)
Ludek
Ludek 2012 年 8 月 8 日
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

採用された回答

Oleg Komarov
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.

その他の回答 (1 件)

Ludek
Ludek 2012 年 8 月 8 日
Thank you, now it works well1 Best,Ludek

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by