Be the first to rate this file! 36 downloads (last 30 days) File Size: 2.18 KB File ID: #24567

SEARCHFILE

by Rahul PN

 

27 Jun 2009 (Updated 08 Jul 2009)

Code covered by BSD License  

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

Download Now | Watch this File

File Information
Description

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
%
 

MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files license.txt,
searchfile.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
08 Jul 2009 Jan Simon

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

Please login to add a comment or rating.
Updates
08 Jul 2009

Updated to correct an issue regarding argument check

08 Jul 2009

updated for argument check

Tag Activity for this File
Tag Applied By Date/Time
dir Rahul PN 29 Jun 2009 10:43:08
find file Rahul PN 29 Jun 2009 10:43:08
search Rahul PN 29 Jun 2009 10:43:08
search file Rahul PN 29 Jun 2009 10:43:08
directory Rahul PN 29 Jun 2009 10:43:08
ls Rahul PN 29 Jun 2009 10:43:08
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com