A = dir
A = dir('/yourpath');
now A has all files and directories. So you can access by loop
to get only Directory indexes you can do following code.
myDir = find(vertcat(A.isdir));
now myDir has indexes of directory(folders only).
to print the name of directory to confirm, you can do it like this.
where first two are only the pointers. you can always start your loop from 3. Ignore first two indexes.
Best Answer