Description
Searches a directory and returns the path of the first file that matches a specified regex pattern
Syntax
FindFile(<searchfolderpath>,<filenamepattern>)
Arguments
Argument |
Type |
Description |
Optional |
searchfolderpath |
text |
Contains a path to a folder to search |
No |
filenamepattern |
text |
Contains Regular Expression string to match against filenames in the search folder |
No |
sorttype |
number |
Flag indicating how to sort files when looking for a match |
Yes – Default = File System Order |
sortorder |
number |
Flag indicating whether to perform ascending or descending sorting during search |
Yes – Default = Ascending |
sorttype
Value |
Description |
1 |
Default – File System Order |
2 |
Sort on Filename |
3 |
Sort on Date Created |
4 |
Sort on Last Modified |
sortorder
Value |
Description |
1 |
Ascending |
2 |
Descending |
Returns
Plain text representation of sourcetext
Examples
Expression: |
FindFile('C:\Temp\', '2018-11-26') |
Returns: |
C:\Temp\Sales Data 2018-11-26.xlsx
|
Expression: |
FindFile('C:\Temp\', FORMATDATE(NOW(), 'yyyy-MM-dd')) |
Returns: |
first filename containing today’s date
C:\Temp\Sales Data 2018-11-26.xlsx
|
Expression: |
FindFile('C:\Temp\', FORMATDATE(DATEADD("dd", -1, NOW()), "yyyy-MM-dd")) |
Returns: |
first filename containing yesterday’s date
C:\Temp\Sales Data 2018-11-25.xlsx
|