This is good - but caution - if in the root directory of a disc '.' and '..' are not returned in dir, so you potentially lose a sub dir. I've added a test, D(i).name == '.' to test for this and adjust accordingly.
18 Mar 2006
Very handy and simple to use. Thank you very much Paul!
11 May 2005
This is exactly what I needed. I'm glad I found it on the Matlab File Exchange. Nice job Paul.