fileloop
| Syntax |
fileloop (identifier in expression1) statements or, fileloop (identifier in expression1, expression2) statements
|
| Action |
Evaluates expression1 as a file system path to a folder. If expression2 is present, evaluates it as a number, to be interpreted as the depth into the folder hierarchy to be visited.
For each file in the folder indicated by expression1, fileloop does the following: 1. assigns the full path of the file to identifier; 2. executes statements.
If a depth is not specified, statements are executed for every file and folder at the main level of the specified folder. If a depth is specified, statements are executed for files only, including those within subfolders to that depth.
|
| Examples |
fileloop (fName in file.getSystemFolderPath ()) {msg (file.fileFromPath (fName)); clock.waitSixtieths (30)}
Posts the name of each item in the System Folder to the Main Window, pausing a half-second between each one. clock.waitSixtieths (30)}
Posts the name of every file on the boot disk to the Main Window, pausing a half-second between each one. |
| Errors |
If expression1 does not specify a valid path to an existing folder, the body statements will not be executed, and an error will be generated.
|
| Notes |
If expression1 is the empty string, the fileloop will iterate over all mounted disk volumes. If expression1 is the empty string and a depth of infinity is specified, the fileloop will iterate over every file on all mounted disk volumes. If the current item being processed is a folder, the path assigned to indentifier will end in the path separator (which you can get from file.getPathChar).
|
| See Also |
break
|