AppCtrlScript

MAY Computer

Help

FOREACHFILE

Applies to  

AppCtrlScript (Module: wmACScr1.dll)

Group  

Other

See also  

FOREACHIN, FOREACHFOLDER, FOREACHLINEINFILE, WHILE, EXITLOOP

Runs the specified sub for each file that can be found in the specified folder.

The following parameters are passed to the sub:

PAR1: Fullname of the file
PAR2: Fullpath of the file (without last "\")
PAR3: Filename without path but with extension
PAR4: Filename without path and extension
PAR5: File extension (without ".")
PAR6: Index (starting with 1)
PAR7: Total number of files found

Use the EXITLOOP command to exit the loop from within the processed subroutine.

Syntax

FOREACHFILE <Folder>, <SubName>[, <Pattern>][, <SubFolders>][, <MaxFiles>]

Part

Description

<Folder> Folder name to search for files
<SubName> Subroutine to perform for each found file. See SUB for details on subroutines.
<Pattern> Optional file mask to filter only wanted files. Default is "*.*"
<SubFolders> Optional 0 or 1, if 1 then subfolders are searched also for matching files.
<MaxFiles>

optional if greater than zero, then the maximum of searched files is set to a limit of <MaxFiles>. The default is 0 which is equal to no limit.