Function Reference


Returns the correct mask for the search for files or folders.

#Include <FileOperations.au3>
_FO_CorrectMask ( $sMask )


$sMask Mask contains valid characters in filenames and wildcards "*" and "?" and the delimiter "|"

Return Value

Success:Returns a correct mask
Failure:Returns the character "|" and @error=2


Function corrects possible errors entered by the user:
1. Removes duplicate elements of the mask. For example, *.avi|*.mpg|*.avi is converted into *.avi|*.mpg (only affects the speed of regular expression)
2. This type of mask *|*.avi or *|*NameFolder handles as * - find everything using a larger range.
3. An empty string means * - to search for all files.
4. Duplicate spaces and dots at the end of each element are removed, i.e., *.avi .|*.mpg |*.vob. converted into *.avi|*.mpg|*.vob, because the file/folder name may not end with these characters.
5. Search differs from searching the Explorer, which was originally set up as: *mask*, i.e., any name containing the mask
* - means any number or absence of characters
? - means any single character.


_FO_FileSearch, _FO_FolderSearch


#include <Array.au3> ; for _ArrayDisplay
#include <FileOperations.au3>

$timer = TimerInit()
$FolderList = _FO_FileSearch(@SystemDir, _FO_CorrectMask('|*.log|*.txt   ..|*.avi..  |||*.log|*.bmp|*.log'))
$timer = Round(TimerDiff($timer) / 1000, 2) & ' sec'
_ArrayDisplay($FolderList, $timer & ' - with correction')
$FolderList = _FO_FileSearch(@SystemDir, _FO_CorrectMask('||||'))
If @error Then MsgBox(0, 'Message', '@error=' & @error)

MsgBox(0, '|*.log|*.txt   ..|*.avi..  |||*.log|*.bmp|*.log', _FO_CorrectMask('|*.log|*.txt   ..|*.avi..  |||*.log|*.bmp|*.log'))
MsgBox(0, '*.avi..  |*|*.log', _FO_CorrectMask('*.avi..  |*|*.log'))

$e = _FO_CorrectMask('|..|  ..  | |')
If @error Then MsgBox(0, '|..|  ..  | |', $e & ' - @error=' & @error)