The FILE_WHICH function separates a specified file path into its component directories, and searches each directory in turn for a specific file. This command is modeled after the UNIX which(1) command.
This routine is written in the IDL language. Its source code can be found in the file file_which.pro in the lib subdirectory of the IDL distribution.
Result = FILE_WHICH( [Path, ] File [, /INCLUDE_CURRENT_DIR] )
Returns the path for the first file for the given name found by searching the specified path. If FILE_WHICH does not find the desired file, a NULL string is returned.
A search path to be searched. If Path is not present, the value of the IDL
The file to look for in the directories given by Path.
If set, FILE_WHICH looks in the current directory before starting to search Path for File. When IDL searches for a routine to compile, it looks in the current working directory before searching
To find the location of this routine:
Result = FILE_WHICH('file_which.pro')
To find the location of the UNIX ls command:
Result = FILE_WHICH(getenv('PATH'), 'ls')
Introduced: 5.4