Utilities/
find.pro
based on file_search, but it is possible to specify
a set of possibles names and a different set of
possibles directories names.
By default look for files included in !path
all file_search keywords can be used.
find find a file
result = find(filein, IODIRECTORY=IODIRECTORY, RECURSIVE=RECURSIVE, REPERTOIRE=REPERTOIRE, NOPRO=NOPRO, ONLYPRO=ONLYPRO, ONLYNC=ONLYNC, UNIQUE=UNIQUE, FIRSTFOUND=FIRSTFOUND, LOOKALLDIR=LOOKALLDIR, TRYFIND=TRYFIND, _extra=_extra)
Return value
A scalar or array variable of string type, containing the
name (with the full path of the matching files. If no files
exist with names matching the input arguments, find returns
the scalar string : 'NOT FOUND'
Parameters
filein
in
required
A scalar or array variable of string type, containing
file names to match. Input names specifications may contain
wildcard characters, enabling them to match multiple files
(see file_search for more informations). By default and if
necessary, find is looking for filename and also for filename
completed with '.pro'
Keywords
IODIRECTORY
default: ['.',!path]
A scalar or array variable of string type, containing
directories names where we are looking for the file.
Different directories can be separated by
path_sep(/search_path) (':' on unix type machine) as it is done
to define !path.
Note that if filename's dirname is different from '.', this
keyword is not taken into account.
RECURSIVE
performs recursive searching of directory hierarchies.
In a recursive search, find looks recursively for any and all
subdirectories in the file hierarchy rooted at the IODIRECTORY argument.
REPERTOIRE
obsolete. keep for compatibility, use directory keyword
NOPRO
activate to avoid the automatic search of filename completed with '.pro'
ONLYPRO
force to look only at file ending with .pro
ONLYNC
force to look only at file ending with .nc
UNIQUE
activate to make sure that each element of the output vector is unique.
FIRSTFOUND
activate this keyword to stop looking for the file as soon as we found one.
LOOKALLDIR
activate to look for the file (with a recursive search if needed)
in . iodir, homedir, !path + the DATA:TestsData directory if it exists.
TRYFIND
if the file was not found and this keyword is activated, find will call
itself with the keywords /LOOKALLDIR and /FIRSTFOUND to try to find
the file we are looking for. Note that if the file was found at the
first try this keyword as no effect (which is not the case with LOOKALLDIR)
_extra
used to pass your keywords
Examples
IDL> print, find('*loadct')
/usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro
/usr/local/rsi/idl_6.0/lib/loadct.pro
IDL> print, find('*loadct', iodir=!dir,/recursive)
/usr/local/rsi/idl_6.0/lib/loadct.pro
/usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro
IDL> print, find('*loadct.pro')
/usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro
/usr/local/rsi/idl_6.0/lib/loadct.pro
IDL> print, find('*loadct',/nopro)
NOT FOUND
IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib')
/usr/local/rsi/idl_6.0/lib/loadct.pro
IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /test_write)
NOT FOUND
IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /recursive)
/usr/local/rsi/idl_6.0/lib/loadct.pro
/usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro
IDL> print, find('mesh*', iodirectory = [iodir, !path])
/Users/sebastie/DATA/ORCA2/meshmaskORCA2closea.nc
/Users/sebastie/IDL/meshmaskclosesea.pro
/Users/sebastie/IDL/meshmaskclosesea.pro~
/Users/sebastie/SAXO_RD/Obsolete/meshlec.pro
/usr/local/rsi/idl_6.0/lib/mesh_obj.pro
Version history
Version
$Id: find.pro 163 2006-08-29 12:59:46Z navarro $
History
Sebastien Masson (smasson@lodyc.jussieu.fr)
28/4/1999
6/7/1999: compatibility mac and windows
June 2005: Sebastien Masson: cleaning, use for file_* functions
Produced by IDLdoc 2.0.