%% Find Files in Subfolders
% List all files in the current folder and all of the subfolders of the current folder.
% Create a folder, myfolder1, that contains these files and folders:
% myfile1.m
% myfolder2
%      myfile2.m
%      myfolder3.m
%          myfile3.m

mkdir myfolder1
mkdir myfolder1/myfolder2
mkdir myfolder1/myfolder2/myfolder3

movefile myfile1.m myfolder1
movefile myfile2.m myfolder1/myfolder2
movefile myfile3.m myfolder1/myfolder2/myfolder3

%
% List all files with a .m extension in myfolder1 and all of the subfolders of myfolder1.

cd myfolder1
dir **/*.m

%
% Copyright 2012 The MathWorks, Inc.