FINDFILE Function
Returns a string array containing the names of all files matching a specified file description.
 
note
When using FINDFILE to find a single file on a UNIX system, the full path to the file is included in the string. On Windows, only the name of the file is returned.
If the names of multiple files are returned, the string contains only the names of the files regardless of the system you performed the search on.
Usage
result = FINDFILE(file_specification)
Input Parameters
file_specification—A scalar string used to find files. May contain any valid shell wildcard characters. If omitted, all files in the current directory are supplied.
 
note
If a filename or directory name used in the file specification string contains a space, the entire string must be enclosed in quotes (either single or double quotes). For example, to find files in the directory:
'Rogue Wave\wave\xres'
you must use the command:
files=FINDFILE('”\Rogue Wave\wave\xres”')
Returned Value
result—A string array containing the names of all files matching file_specification. If no files with matching names exist, returns an array with a single empty element.
Keywords
Count—A named variable into which the number of files found is placed. A value of 0 indicates that no files were found.
Verbose (Unix only)—If set, allows the shell process to print all messages it produces to stderr. Otherwise it is silent even when an error occurs. Default: Verbose is off.
Discussion
FINDFILE returns all matched filenames in a string array, one file name per array element.
 
note
Under UNIX, FINDFILE uses the shell specified by the SHELL environment variable (or /bin/sh if SHELL is not defined) to search for any files matching file_specification.
Example
This example searches the wave/lib/std directory for PV-WAVE procedure files that start with the letter 'x'.
CD, !Dir + '/lib/std', Current=curr_dir
result = FINDFILE('x*.pro', Count=cntr)
PRINT, result
; PV-WAVE prints:
; xbar.pro xrchart.pro xschart.pro
PRINT, cntr
; PV-WAVE prints: 3
CD, curr_dir
See Also