|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > FIL. - File-Commands > FIL. - File and Directory Commands |
SPR Script Language
FIL.DIR-Commands
A comprehensive suite of commands for scanning the file system.
Chapter Overview
This chapter introduces a powerful set of commands under the FIL. prefix, designed to find and list files and directories. These commands offer a wide range of flexibility, from simple scans of a single folder to complex, recursive searches across multiple directories using wildcards. Results can be conveniently stored in global arrays for detailed processing or returned as a single, formatted string for quick use.
Command Groups
1. Single-Folder Scanning: These commands operate on a single base path. Wildcards are only supported in the final part of the path (the filename or directory name).
• FIL.DIRF - Returns a list of Files from a single directory.
• FIL.DIRS - Returns a list of Directories from a single directory.
• FIL.DIR - Returns a list of both Files and Directories from a single path.
2. Multi-Folder Scanning: These advanced commands allow wildcards in the directory portions of the path, enabling searches across many folders at once.
• FIL.MFDIR - Searches for Files across multiple folders using wildcards.
• FIL.MFDIRS - Searches for Directories across multiple folders using wildcards.
• FIL.MFDIRA - Searches for both Files and Directories across multiple folders.
3. Output & Utility Commands: These commands provide alternative ways to receive and handle the results.
• FIL.GetDirArr - Simplified command to get a directory listing into an array.
• FIL.GetDir - Returns a directory listing directly to a single string variable.
• FIL.ArrayToVar - Converts a result array into a single, CR-LF delimited variable.
Common Concepts
Array Output: All commands that output to an array will place a summary string at index 0 in the format: "LastUsedIndex,FileCount,DirCount". The actual file/directory paths start at index 1.
Options: Most commands accept an optional, comma-separated string of options like SUBDIR, INFO, SORTUP, and SORTDOWN to customize the search and the output format.