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:

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:

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/itt/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.

Version History

Introduced: Original