The features described in this topic are obsolete
and should not be used in new IDL code.
FINDFILE
This routine is obsolete and should not be used in new IDL code.
The FINDFILE function retrieves a list of files that match File_Specification.
Note
Use the FILE_SEARCH function, included in IDL 5.5 and later, in place of the FINDFILE function. FILE_SEARCH offers many advantages over FINDFILE, including cross-platform consistency in wildcard syntax, uniform presentation of results, filtering by file attributes, and, under UNIX, freedom from performance and number of file limitations encountered by FINDFILE.
Platform specific differences are described below:
- Under UNIX, to include all the files in any subdirectories, use the * wildcard character in the File_Specification, such as in
result = FINDFILE('/path/*'). If File_Specification contains only a directory, with no file information, only files in that directory are returned. - Under Windows, FINDFILE appends a "\" character to the end of the returned file name if the file is a directory. To refer to all the files in a specific directory only, use
result = FINDFILE('\path\*').
Syntax
Result = FINDFILE( File_Specification [, COUNT=variable] )
Return Value
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.
Arguments
File_Specification
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.
Keywords
COUNT
A named variable into which the number of files found is placed. If no files are found, a value of 0 is returned.
Examples
To print the file names of all the UNIX files with .dat extensions in the current directory, use the command:
To print the full path names of all .pro files in the IDL lib directory that begin with the letter "x", use the command:
To print the path names of all .pro files in the profiles subdirectory of the current directory (a relative path), use the command:
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.
Version History
Introduced: Original