
If FilePattern contains a relative path rather than an absolute path, the path here will also be relative. The path and name of the file/folder currently retrieved. The name of the file or folder currently retrieved (without the path). If an inner file loop is enclosed by an outer file loop, the innermost loop's file will take precedence: Variable The following variables exist within any file loop. Special Variables Available Inside a File Loop All subfolders will be recursed into, not just those whose names match FilePattern. 1 = Subfolders are recursed into so that files and folders contained therein are retrieved if they match FilePattern.2 = Only folders are retrieved (no files).1 = All files and folders that match the wildcard pattern are retrieved.0 = Folders are not retrieved (only files).Otherwise, specify one of the following digits: no wildcards) and Recurse is set to 1, more than one match will be found if the specified file name appears in more than one of the folders being searched. If this parameter is a single file or folder (i.e. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified. The name of a single file or folder, or a wildcard pattern such as C:\Temp\*.tmp. Loop, FilePattern, IncludeFolders, Recurse Parameters FilePattern Use the new syntax described above instead. If R is omitted, files and folders in subfolders are not included.ĭeprecated: This syntax is not recommended for use in new scripts. R = Recurse into subdirectories (subfolders).If both F and D are omitted, files are included but not folders. Otherwise, specify one or more of the following letters: If blank or omitted, only files are included and subdirectories are not recursed into. This limit can be bypassed by using the \\?\ long path prefix, with some stipulations. Patterns longer than 259 characters may fail to find any files due to system limitations (MAX_PATH). no wildcards) and Mode includes R, more than one match will be found if the specified file name appears in more than one of the folders being searched. A match occurs when the pattern appears in either the file's long/normal name or its 8.3 short name. FilePattern is assumed to be in A_WorkingDir if an absolute path isn't specified.īoth asterisks and question marks are supported as wildcards. The literal word Files (case-insensitive).

New Syntax Loop, Files, FilePattern, Mode Parameters Files Retrieves the specified files or folders, one at a time. Loop (files & folders) - Syntax & Usage | AutoHotkey v1 Loop (files & folders)
