choose recent file
Utility Library
This function will either identify the most recent file according to a specified ordering criteria.
Under normal conditions, the 'Utility Library' is loaded automatically, so no 'include(...)' call is needed.
5
No. | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1. input |
string | Prompt text A prompt text is needed if the count (provided in the last function parameter) is not 1. The prompt will be displayed if needed so you can select from of the n recent files displayed. | ||||||||||||
2. input |
string | Path name Specify the path name to the directory where the files to be searched are located. No wildcards are supported here. | ||||||||||||
3. input |
string | File name pattern to match Specify file name pattern where the file name part may contain wildcard symbols such as '*' and '?'. The pattern will be used to obtain a listing of matching files which will then be prioritzed by the ordering criteria. Exammple: "b4p*.txt" covers all files beginning wtih "b4p" and ending with file type ".txt". | ||||||||||||
4. input |
string | Ordering criteria One of the following values apply:
| ||||||||||||
5. input |
numeral | Count Valid range: 1-35 |
Type | Description |
---|---|
string | Identified file name The file name contains no directory path. If no file has been found, then a blank string is returned. |
If no file is found, and verbose level is not 'quiet', then an error message will warn you about no files found. You have the choice to stop or continue
a[] = choose recent file( "", "Examples\", "*table*.b4p", first, 1 ); // No user interaction
echo("First file in alphabetic order containing 'table' is ", a[] );
a[] = choose recent file( "", "Examples\", "*table*.b4p", last, 1 ); // No user interactino
echo("First file in alphabetic order containing 'table' is ", a[] );
a[] = choose recent file( "Please choose one of the newest files: ", "Examples\", "*.b4p", newest, 5 );
echo("Chosen file is: ", a[] );
First file in alphabetic order containing 'table' is REF_Features_Table_columns.b4p
First file in alphabetic order containing 'table' is REF_Function_with_table.b4p
Found 382 files.
Please choose one of the newest files:
1 : REF_Function_variable_to_json.b4p (2020-10- 3 17:57:34 0 kB)
2 : REF_Function_vertical.b4p (2020-10- 3 17:57:34 0 kB)
3 : REF_Function_week.b4p (2020-10- 3 17:57:34 0 kB)
4 : REF_Function_weekday.b4p (2020-10- 3 17:57:34 0 kB)
5 : REF_Function_while.b4p (2020-10- 3 17:57:34 0 kB)
Please select: 3
Chosen file is: REF_Function_week.b4p