Code covered by the BSD License  

Highlights from
SEARCHFILE

4.5

4.5 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 2.18 KB File ID: #24567

SEARCHFILE

by Rahul PN

 

27 Jun 2009 (Updated 08 Jul 2009)

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

| 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)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
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.

13 Aug 2010 Jamie Rodgers

very useful. Tx

12 Oct 2011 Szilárd

Useful file!

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

Contact us at files@mathworks.com