xdir.m – more powerful rdir.m

It offers the same syntax as rdir.m but differs in two major ways:

1) performs processing on pathnames from a list
2) supports relative paths in the wildcard expression

To demonstrate what the above means in practical terms, assume that you have the following hierarchy:


For some reason you already have a list of preselected c1 files. Now you want to find c2 files in the y subdirectory of those top-level directories from which the c1 files come from. With xdir.m you can do the following:

pathnames = {...}; % list of preselected c1 files
result = xdir(pathnames, '../**/y*/c2*');

Yesterday to achieve that we had to write a couple of lines of code. Not anymore.

One more remark – xdir.m uses / as file separator internally and provides output using /. It accepts input with both / and used as separator. So in my feeling, it is more convenient than rdir.m.

DOWNLOAD: xdir.zip

Leave a Reply

Your email address will not be published. Required fields are marked *