Genpath is excluding package folders

4 views (last 30 days)
Hello,
I am writing a script that requires to know every folder and subfolder, for which genpath() works perfectly.
However, there are a few folders that are packages (and begin with a '+'), and genpath ignores those.
Is it possible to have genpath include those, or some other way to automatically include that?
Thanks!
  1 Comment
Walter Roberson
Walter Roberson on 23 Aug 2017
No, it is not possible to set any flags or pass any options to genpath to cause it to return + directories: processing of them is hard-coded. genpath also removes @ directories.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 18 Aug 2017
Try using dir() with double asterisks. See the help or my attached demo.
  2 Comments
Matthew Brown
Matthew Brown on 23 Aug 2017
Thanks, dir('**/*.m') does what I need it to do.
However, does that only work in 2016+? The code I am writing will need to be backwards compatible with versions back to 2012B.

Sign in to comment.

More Answers (1)

Jan
Jan on 23 Aug 2017

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!