If I want all the name of the files with an extension .jpg in different directories so far I use this:
dir1='~/dir1'dir2='~/dir2'dir3='~/dir3'imageDirs={dir1 dir2 dir3};fnames=dir([dir1 '/*.jpg']);files={fnames.name}';for i=2:length(imageDirs) fnames=dir([imageDirs{i} '/*.jpg']); newIm={fnames.name}'; diffIm=setdiff(files,newIm); files=[files(:);diffIm]; diffIm=setdiff(newIm,files); files=[files(:);diffIm];end files=unique(files);
but I don't think that is efficient at all haha. Any suggestions I will really appreciate that
Best Answer