File Exchange

image thumbnail

SEARCHFILE

version 1.2 (2.18 KB) by

Search for files and directories under a given folder with recursive and filter options

3 Downloads

Updated

View License

Here is the help comments for the file which will provide an overview.

% SEARCHFILE search for files and/or directories under a given folder
% Syntax
% list = searchfile('dir', 'filter', 'recflag')
%
% 'dir'(Optional) -
% The source directory where to search. If not specified,
% current working directory will be used
%
% 'filter'(Optional) -
% File filter('*.txt', 'ABC*.*' etc)
%
% 'recflag'(Optional) -
% 1 = Recurse into subdirectory, otherwise look only in
% the specified/current directory
%
% Eg: list = searchfile('C:\Temp', '*.txt', 1);
% list = searchfile('*.txt', 1);
% list = searchfile(1);
%
% Return value : Structure with following fields
% 'name' - Name of the file/directory
% 'path' - Path to the file/directory
% 'fullpath' - Full path of the file/directory including its
% name
% 'isdir' - Flag indicates whether a directory or file
% 1 = Directory, 0 = File
%
 

Comments and Ratings (3)

Useful file!

very useful. Tx

Jan Simon

Jan Simon (view profile)

It's worth to mention, that the program calls DOS to perform the search. Therefore this function will not work under Mac and linux.

Updates

1.2

updated for argument check

1.1

Updated to correct an issue regarding argument check

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video