Click here to show toolbars of the Web Online Help System: show toolbars |
In the resulting string array, LISTFILES returns paths using either forward or backward slashes, depending on the platform. If working on a supported Matrox smart camera platform (MIOS), the path separators are forward slashes (/). On a PC runtime platform (Windows), the path separators are backward slashes (\). For information on specifying a file path, see the Specifying a path section in Appendix A: Expression syntax.
Common uses for this function include:
Finding the largest files in a folder.
Finding the oldest files in a folder.
Counting the number of files in a folder.
Getting a list of file names, sorted alphabetically.
Determining if the total size of files in a folder exceeds a specified threshold and identifying the oldest files for deletion if it does.
Specifies the path to the folder.
1. |
The following example returns all files, in the SavedImages subfolder of the DA Documents folder, with their full name. Specifically, on a Matrox Iris GTR, if the folder contains 2 files, LISTFILES returns the string array listed in the table below.
LISTFILES(CONCAT(PATH("DA Documents"),"\\SavedImages"))
|
||||||
2. |
The following example returns all files, in the folder C:\Temp\, with their full name. Specifically, on a PC runtime platform, if the folder contains 2 files, LISTFILES returns the string array listed in the table below.
LISTFILES("C:\\Temp\\")
|
||||||
3. |
The following example returns all files, in the network folder \\MYMACHINE\ResultsArchive, with their full name. Specifically, on a PC runtime platform, if the folder contains 2 files, LISTFILES returns the string array listed in the table below.
LISTFILES("\\\\MYMACHINE\\ResultsArchive")
|
Specifies the path to the folder.
Specifies the search string to match against the names of files in the path. This parameter can contain a combination of a valid literal path and wild card characters (* and ?), but does not support regular expressions.
1. |
The following example returns all files, in the SavedImages subfolder of the DA Documents folder, that have the extension .jpg.
LISTFILES(CONCAT(PATH("DA Documents"), "\\SavedImages"),
"*.jpg")
|
2. |
The following example returns all files, in the network folder \\MYMACHINE\ResultsArchive, that have a name containing the word "ARCHIVED".
LISTFILES("\\\\MYMACHINE\\ResultsArchive",
"*ARCHIVED*")
|
Specifies the path to the folder.
Specifies the search mode. You can specify one or more of the following options. To specify more than one option, use the "|" symbol.
Value | Description |
Files | |
Folders | |
Recursive |
Lists the outcome of a search that includes the specified folder and all its subfolders. |
Reverse |
Lists the outcome of the search in opposite order (from last to first). |
ShortNames |
Lists the names of the files or folders without their full path. |
SortByExt |
Lists files sorted by their extension. |
SortByName |
Lists all entries sorted by their short name. |
SortBySize |
Lists all entries sorted by size. |
SortByTime |
Lists all entries sorted by their last modified date. |
1. |
The following example returns all files, in the DA Documents folder and fully recursively through its subfolders. The files are sorted by size and are listed only by file name (the full file path is omitted).
LISTFILES(PATH("DA Documents"), SortBySize | Recursive |
ShortNames)
|
Specifies the path to the folder.
Specifies the search string to match against the names of files in the path. This parameter can contain a combination of a valid literal path and wild card characters (* and ?), but does not support regular expressions.
Specifies the search mode. You can specify one or more of the following options. To specify more than one option, use the "|" symbol.
Value | Description |
Files | |
Folders | |
Recursive |
Lists the outcome of a search that includes the specified folder and all its subfolders. |
Reverse |
Lists the outcome of the search in opposite order (from last to first). |
ShortNames |
Lists the names of the files or folders without their full path. |
SortByExt |
Lists files sorted by their extension. |
SortByName |
Lists all entries sorted by their short name. |
SortBySize |
Lists all entries sorted by size. |
SortByTime |
Lists all entries sorted by their last modified date. |
1. |
The following example returns all files and subfolders in the DA Documents folder. This includes all subfolders and the files they contain. The folders will be listed at the beginning of the returned array, sorted alphabetically by their short name. This will be followed by the files, also sorted by their short name.
LISTFILES(PATH("DA Documents"), "*", Recursive | SortByName |
Folders | Files)
|
Specifies the path to the folder.
Specifies the search string to match against the names of files in the path. This parameter can contain a combination of a valid literal path and wild card characters (* and ?), but does not support regular expressions.
Specifies the search mode. You can specify one or more of the following options. To specify more than one option, use the "|" symbol.
Value | Description |
Files | |
Folders | |
Recursive |
Lists the outcome of a search that includes the specified folder and all its subfolders. |
Reverse |
Lists the outcome of the search in opposite order (from last to first). |
ShortNames |
Lists the names of the files or folders without their full path. |
SortByExt |
Lists files sorted by their extension. |
SortByName |
Lists all entries sorted by their short name. |
SortBySize |
Lists all entries sorted by size. |
SortByTime |
Lists all entries sorted by their last modified date. |
These values can also be used in combination with the above values; however, in this case, you must specify a value for the Limit parameter:
Value | Description |
CumulativeSize | |
ExceedingAge |
Lists only the files that are older than Limit (in sec). |
ExceedingCount | |
ExceedingCumulativeSize | |
ExceedingSize |
Lists only the files that have a size greater than Limit (in Mbytes). |
Specifies the numeric limit of the Exceeding values of SearchMode. The possible values for this parameter are explained in the description of the previous parameter.
1. |
The following example returns all files, in the SavedImages subfolder of the DA Documents folder, that are older than the last 24 hours (60 sec * 60 min * 24 hour). The files are sorted with the newest files first.
LISTFILES(CONCAT(PATH("DA Documents"), "\\SavedImages"), "*",
SortByTime | ExceedingAge, 60*60*24)
|
2. |
The following example returns all files, in the SavedTextFiles subfolder of the DA Documents folder, with a size greater than 20 Mbytes.
LISTFILES(CONCAT(PATH("DA Documents"), "\\SavedTextFiles"), "*",
ExceedingSize, 2)
|
3. |
The following example returns all files, in the SavedImages subfolder of the DA Documents folder, excepting the first 50 Mbytes of files starting with the newest. Note that the ExceedingCumulativeSize setting is calculated after any sort settings have been applied.
LISTFILES(CONCAT(PATH("DA Documents"), "\\SavedImages"), "*",
SortByTime | ExceedingCumulativeSize, 50)
|
4. |
The following example returns the oldest files, in the SavedImages subfolder of the DA Documents folder, except for the newest 5. Note that the ExceedingCount setting is calculated after any sort settings have been applied. The example sorts the returned list by time and reverses the output order; therefore, the oldest files are listed first. If there were only 6 files in this location, our example would simply return the oldest file.
LISTFILES(CONCAT(PATH("DA Documents"), "\\SavedImages"), "*",
SortByTime | Reverse | ExceedingCount, 5)
|
5. |
The following example returns all files, in the D:\TestImages\SecondPhase folder, that are older than the last 24 hours (60 sec * 60 min * 24 hour). The files are sorted with the newest files first.
LISTFILES("D:\\TestImages\\SecondPhase", "*", SortByTime |
ExceedingAge, 60*60*24)
|