The FINDFILE function retrieves a list of files that match File_Specification.
| Note |
Platform specific differences are described below:
result = FINDFILE('/path/*'). If File_Specification contains only a directory, with no file information, only files in that directory are returned.result = FINDFILE('\path\*').Result = FINDFILE( File_Specification [, COUNT=variable] )
All matched filenames are returned in a string array, one file name per array element. If no files exist with names matching the File_Specification, a null scalar string is returned instead of a string array. FINDFILE returns the full path only if the path itself is specified in File_Specification. See the "Examples" section below for details.
A scalar string used to find files. The string can contain any valid command-interpreter wildcard characters. If File_Specification contains path information, that path information is included in the returned value. If File_Specification is omitted, the names of all files in the current directory are returned.
A named variable into which the number of files found is placed. If no files are found, a value of 0 is returned.
To print the file names of all the UNIX files with .dat extensions in the current directory, use the command:
PRINT, FINDFILE('*.dat')
To print the full path names of all .pro files in the IDL lib directory that begin with the letter "x", use the command:
PRINT, FINDFILE('/usr/local/rsi/idl/lib/x*.pro')
To print the path names of all .pro files in the profiles subdirectory of the current directory (a relative path), use the command:
PRINT, FINDFILE('profiles/*.pro')
Note that the values returned are (like the File_Specification) relative path names. Use caution when comparing values against this type of relative path specification.
Introduced: Original