File Exchange

image thumbnail


version 1.0.0 (2.95 KB) by Bramvg
a dialog box to search files recursively using wildcard symbols * and **

1 Download

Updated 29 Aug 2019

View License

searchfiles shows a dialog to search files recursively

files = searchfiles
files = searchfiles(startfolder, filterspec, limit, dialogname)
[files, startfolder, limit, option] = searchfiles(startfolder,...
filterspec, limit, dialogname, optiontext, optiondefault)

A dialog is shown where the user can search files recursively using
wildcard symbols (* and **), with the option to limit the number of files
per folder, and with an optional custom checkbox.

INPUT ARGUMENTS (all arguments are optional):
startfolder = root folder to start search (default is pwd)
filterspec = search string, supports wildcards same as dir (default
is '\**\*.*')
limit = limit number of files per folder (default is 0 = no limit)
dialogname = figure name of the dialog window (default = 'Search files')
optiontext = text label of an optional checkbox. the checkbox is only
shown if optiontext is not empty (default is empty)
optiondefault = initial state of the optional checkbox (default is

files = cell array of strings of selected file names, if cancel is
clicked files is 0
startfolder = root folder (same as input unless the user browsed to a
new folder in the dialog)
limit = same as input unless user changed number in dialog
option = state of the optional checkbox (true or false)

Cite As

Bramvg (2020). searchfiles (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)


searchfiles does not replace the built-in file searching tool. It is more meant as replacement of uigetfile, with the option to search files recursively.

Stephen Cobeldick

Note that MATLAB includes an inbuilt file searching tool:

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags