ForEach...Folder...Do...Od
You can use the statement ForEach ... Folder to process objects in a folder.
Syntax
Var Text File;
ForEach File
Folder "path\foldername"
Do
... ;
Od;
The Foreach ... Folder loops over all files and directories in a folder. For each object, the name is assigned to the variable File before the Do ... Od code is processed.
You can use the command Break to terminate the loop prematurely.
The content of directories is not processed. Recursion must be handled explicitly by the script.
If the contents of the folder change while ForEach ... Folder is processing, the behaviour is undefined.
Example
Var Text File;
Var Text ResultDirectory = "C:\ITPResult";
ForEach File
Folder ResultDirectory
Do
If file_format(File) = "doc"
THEN
DoctoPDF
Src (File)
Dest (File[,"pdf"]);
Fi;
Od;
This converts all Microsoft Word files in the c:\ITPResult directory to PDF.