<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

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.

topfind find a file

result = find(filein, IODIRECTORY=scalar string or array of strings, 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 type: scalar string or array of strings

File name[s] 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        type: scalar string or array of strings default: ['.',!path]

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 IODIRECTORY 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. Return a scalar string containing the first file found

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 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 375 2008-08-08 15:55:40Z pinsard $

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

Statistics

McCabe cyclic 22
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.