And now...A Recursive DIR Command that Accommodates a Complex Filterspec!
In my most recent blog post, I commented on the fact that we don't have a ready way in MATLAB of providing a complex filter specifier in a call to DIR. I laid out a list of things I'd like to be able to do with DIR, and challenged our readers to jump in the game.
And jump in you did!
I also promised to feature in my next Pick of the Week (i.e., this one), the first author and submission that met all of the criteria I laid out. The submission, I wrote, should:
- enable searching for multiple file formats;
- allow recursive or non-recursive searches;
- provide a command-line (non-GUI) interface;
- work "out-of-the-box" in R2012b--without requiring a lot of effort on my (a user's) part;
- return results in the same format that the dir command returns; and
- be shared under a BSD license.
The ink had barely dried on my Post before I received a link from Evgeny to a file that appears to meet most of my criteria. But that file is not shared on the File Exchange. And I have the sense that if I were better at understanding his instructions and writing my own regular expressions, Evgeny's dirwalk could be coerced to do what I requested. For his efforts, we'll be sending Evgeny some MATLAB swag.
Only slightly later in the afternoon, Jonathan shared his own submission to "DIR2: Recursive Directory Searching for Multiple File Specs". I was already thrilled with Jonathan's submission--he had earned this honor--when it got even better. Less than two weeks after the challenge was issued and DIR2 was uploaded, Jonathan improved his submission by converting it to MEX to speed it up. And it is fast! Very nice job, Jonathan--your file does everything I requested, and is exceptionally easy to use! For your efforts and code, an A+, a Pick-of-the-Week tag, and some cool swag coming your way!
Before I move on: Mikko, if you can show me how to get ls2 to do what I requested, I'll send you some swag, too. I tried, but can't seem to get the desired results.
As always, I welcome your thoughts and comments.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.