Search methods

Search methods --  Types of methods what can be used in search functions

Search methods and their patterns

All search functions use $pattern parameter to specify match for filenames. Format of the $pattern depends on value of another parameter - $pattern_type.

'shell' search mode file masks

File masks are used to select single files and folders or groups of them. Masks may contain common valid file name symbols, wildcards ('*' and '?') and special expressions:

* any number of characters;
? any single character;
[c,x-z] any character enclosed by the brackets. Both separate characters and character intervals are allowed.

For example, files ftp.exe, fc.exe and f.ext may be selected using mask f*.ex?, mask *co* will select both color.ini and edit.com, mask [c-f,t]*.txt can select config.txt, demo.txt, faq.txt and tips.txt.

You may enter several file masks separated with commas or semicolons. For example, to select all the documents, you can specify *.doc,*.txt,*.wri in search pattern.

You may use exclude masks. An exclude mask is one or multiple file masks that must not be matched by the files matching the mask. The exclude mask is delimited from the main mask by the character '|'.

Usage examples of exclude masks:

  1. *.cpp

    All files with the extension cpp.

  2. *.*|*.bak,*.tmp

    All files except for the files with extensions bak and tmp.

  3. *.*|

    This mask has an error - the character | is entered, but the mask itself is not specified.

  4. *.*|*.bak|*.tmp

    Also an error - the character | may not be contained in the mask more than once.

  5. |*.bak

    The same as *|*.bak

The comma (or semicolon) is used for separating file masks from each other, and the '|' character separates include masks from exclude masks.

'shell' match mode is available from version 1.2.0 of File_Find

    Поддержать сайт на родительском проекте КГБ