findFile

findFile finds recursively all files in root.

Syntax

Description

example

list =findFile(root) findFile with all default options.

example

list =findFile(root, Name, Value) findFile with optional arguments.

Examples

expand all

  • findFile with all default options.
  • find the location of findFile.m

    FullPath=which('findFile');
    %extract the directory containing findFile.m
    root=fileparts(FullPath);
    %list the content of the directory containing findFile.m
    list = findFile(root);

  • findFile with optional arguments.
  • Make sure that the FSDA path is loaded (call routine addFSDA2path).

    addFSDA2path
    % Find the location of findFile.m
    FullPath=which('addFSDA2path');
    % extract the root directory of FSDA
    FSDAroot=fileparts(FullPath);
    %list the content of the directory under FSDA named 'graphics'
    list = findFile(FSDAroot,'InclDir','graphics');

    Related Examples

    expand all

  • List the content of the directory under FSDA named 'graphics' and exclude all those which start with res.
  • % find the location of findFile.m
    % Make sure that the FSDA path is loaded (call routine addFSDA2path).
    addFSDA2path
    FullPath=which('addFSDA2path');
    % extract the root directory of FSDA
    root=fileparts(FullPath);
    disp('Path of FSDA root is:')
    disp(root)
    disp('----')
    list = findFile(root,'InclDir','graphics','ExclFiles','res*');

  • find the location of help file gplotmatrix.
  • html.

    pathdocroot=docroot;
    pathExtHelpFile=findFile(pathdocroot,'InclFiles','gplotmatrix.html');

    Input Arguments

    expand all

    root — Root directory. String.

    Case sensitive string that can indicate relative or absolute path. Use '.' for current directory.

    Data Types: string

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'InclDir','dirname' , 'ExclDir','dirname' , 'InclFiles','filename' , 'ExclFiles','filename'

    InclDir —Include directory pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression, for examples 'abc' and 'ab*de*'. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed. Case-sensitive.

    This filter is skipped if InclDir='', InclDir={}, InclDir='*' or if one of the element of the cell array InclDir is '*'. Default: InclDir={''}.

    Example: 'InclDir','dirname'

    Data Types: (cell array of) string

    ExclDir —Exclude directory pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression. Examples: 'abc' and 'ab*de*'. Use '' or {} to skip this stage. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed. Case-sensitive. Default: ExclDir={''}.

    Example: 'ExclDir','dirname'

    Data Types: (cell array of) string

    InclFiles —Include file pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression.

    Use '*' to include all files. Note that '*' and '*.*' give the same behaviour and return all files. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed.

    Case-sensitive. Default: InclFile={'*'}.

    Example: 'InclFiles','filename'

    Data Types: (cell array of) string

    ExclFiles —Exclude file pattern(s).string | cell arrays of strings.

    User can use wildcards. Do not use regular expression.

    Use '' or {} to skip this check. File separator (i.e. '\' in Windows or '/' in Unix) is not allowed.

    Case-sensitive. Default: ExclFiles={''}.

    Example: 'ExclFiles','filename'

    Data Types: (cell array of) string

    Output Arguments

    expand all

    list —All files. Cell array of strings

    List of all files matched under root directory, sorted in alphabetical and ascending order. Always return absolute path.

    References

    See Also

    This page has been automatically generated by our routine publishFS