function imname = bodir(datadir, name)

% remove rootdir
imname = dir(datadir);
imname(1:2) = [];

% remove rootdir and a specified subdir
if nargin > 1
   for i = 1:length(imname)
       if strcmp(imname(i).name,name)
          ind = i;
          break;
       end
   end
imname(ind) = [];
end

