FINDFILES Returns all files in a directory with a specified extension. FILES=FINDFILES(DIRNAME,EXT) where DIRNAME is a full directory path, returns a cell arrays FILES of all files having extension EXT in directory DIRNAME. For example, FILES=FINDFILES('/Users/lilly/Home','m') returns a cell cell array of all m-files in the Home directory. FINDFILES(DIRNAME,'*') returns files having any extension. FINDFILES(DIRNAME,'') returns files having no extension. This can be used to return directory names. ___________________________________________________________________ Recursive searching FINDFILES(DIRNAME,...,'recursive') recursively searches though directory DIRNAME as well as any subdirectories it contains. [FILES,PATHS]=FINDFILES(DIRNAME,...,'recursive') also outputs a cell array PATHS specifying the full path name to each file in FILES. FINDFILES(DIRNAME,...,'recursive','ignore_private') will ignore any directories named 'private' as a part of this recursive search. ___________________________________________________________________ Additional options FINDFILES(...,'include',STR1) additionally returns only those file names which inlude the text STR1. FINDFILES(...,'exclude',STR2) excludes those files names which include the text STR2. The include and exclude options must be input after the first two variables. Both options may be input simultaneously. ___________________________________________________________________ Usage: files=findfiles(pwd,'m'); files=findfiles(dirname,ext); files=findfiles(dirname,ext,'include','help'); [files,dirs]=findfiles(dirname,ext,'include','help','recursive'); files=findfiles(dirname,ext,'include','help','exclude','jLab'); 'findfiles --t' runs a test. __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2006--2019 J.M. Lilly --- type 'help jlab_license' for details