Saturday, March 20, 2010

automated direcotry listing in matlab

Very simple program for listing the file names as I had to monitor the files from many folders for repetitive works.



clear all
clc
% Read directory names
dirLIST = ls;

% get number of directories
N = length(dirLIST)

% Loop through the directories
% Skip the first two..
for n = 3:N

    % Close all open figures
%     close all;
  
    thisDIR = dirLIST(n,:);

    if isempty(strfind(thisDIR,'.'))
        cd(thisDIR);
      
        ls
        pwd
        pause
%         home
      
 cd('..');

    end
end
cd ..
pwd

No comments: