GetFileList
The GetFileList function returns a lua table containing the full path name for files in a folder. The names are full path names including the full path. The names must match the specified template, which can be simply "*.*". Also see the CFindFiles class for another way to collect files from a folder.
nFiles = GetFileList( sFolder, sTemplate, tblNames )
sFolder is the folder to search.
sTemplate is the name pattern to match.
tblNames is a table containing the file names, including the full path.
On success, nFiles > 0 and tblNames contains an array of file name strings.
On failure, nFiles=0.
This example selects a target folder, matches all FITS image files matching the template "*.fts" and then lists them. Note that the entire for loop could be replaced by list(tbl) but the latter method does not permit formatting using Printf.
-- get the folder |
|
|
|
-- default location |
|
|
-- select folder in GetFolder() |
|
|
|
|
-- find all "*.fts" files in the folder |
|
|
|
-- create a table for the file names |
|
|
-- find files of this type |
|
|
-- return the table of file names |
|
|
|
|
-- list the file names from the table: |
|
|
|
|
|
|
|
|
|
|
|
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.