Changeset 128 for trunk/SRC/Utilities/find.pro
- Timestamp:
- 07/06/06 16:32:02 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/find.pro
- Property svn:eol-style deleted
- Property svn:executable deleted
r121 r128 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; @file_comments based on file_search, but it is possible to specify 6 ; a set of possibles names and a different set of 7 ; possibles directories names. 8 ; By default look for files included in !path 5 ; @file_comments 6 ; based on file_search, but it is possible to specify 7 ; a set of possibles names and a different set of 8 ; possibles directories names. 9 ; By default look for files included in !path 10 ; 11 ; all file_search keywords can be used. 9 12 ; 10 13 ; @categories find a file … … 21 24 ; 22 25 ; @keyword IODIRECTORY {default=!path} A scalar or array variable of string type, containing 23 ; directories names where we are looking for the file. 26 ; directories names where we are looking for the file. 24 27 ; Different directories can be separated by 25 28 ; path_sep(/search_path) (':' on unix type machine) as it is done … … 39 42 ; 40 43 ; @keyword RECURSIVE performs recursive searching of directory hierarchies. 41 ; In a recursive search, find looks recursively for any and all 44 ; In a recursive search, find looks recursively for any and all 42 45 ; subdirectories in the file hierarchy rooted at the IODIRECTORY 43 ; argument. 46 ; argument. 44 47 ; 45 48 ; @keyword REPERTOIRE obsolete. keep for compatibility, use directory keyword … … 50 53 ; @keyword _EXTRA used to pass your keywords 51 54 ; 52 ; @file_comments all file_search keywords can be used.53 55 ; 54 56 ; @returns A scalar or array variable of string type, containing the … … 57 59 ; the scalar string : 'NOT FOUND' 58 60 ; 59 ; @examples 61 ; @examples 60 62 ; 61 ; IDL> print, find('*loadct')63 ; IDL> print, find('*loadct') 62 64 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 63 65 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 64 ; 66 ; IDL> print, find('*loadct', iodir=!dir,/recursive) 65 67 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 66 68 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 67 ; IDL> print, find('*loadct.pro')69 ; IDL> print, find('*loadct.pro') 68 70 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 69 71 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 70 ; IDL> print, find('*loadct',/nopro)72 ; IDL> print, find('*loadct',/nopro) 71 73 ; NOT FOUND 72 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib')74 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib') 73 75 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 74 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /test_write)76 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /test_write) 75 77 ; NOT FOUND 76 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /recursive)78 ; IDL> print, find('*loadct', iodir = '/usr/local/rsi/idl_6.0/lib', /recursive) 77 79 ; /usr/local/rsi/idl_6.0/lib/loadct.pro 78 80 ; /usr/local/rsi/idl_6.0/lib/utilities/xloadct.pro 79 ; 81 ; IDL> print, find('mesh*', iodirectory = [iodir, !path]) 80 82 ; /Users/sebastie/DATA/ORCA2/meshmaskORCA2closea.nc 81 83 ; /Users/sebastie/IDL/meshmaskclosesea.pro … … 103 105 ; 104 106 CASE 1 OF 105 keyword_set(lookalldir):BEGIN 107 keyword_set(lookalldir):BEGIN 106 108 @cm_general 107 109 dirnames = [iodir, homedir, !path] … … 142 144 ENDCASE 143 145 ; use dirnames only if dir eq '.' 144 IF dir EQ '.' THEN BEGIN 146 IF dir EQ '.' THEN BEGIN 145 147 if keyword_set(recursive) THEN $ 146 148 found = file_search(dirnames, base, _extra = ex) $ 147 149 ELSE found = file_search(dirnames + '/' + base, _extra = ex) 148 150 ENDIF ELSE found = file_search(dir + '/' + base, _extra = ex) 149 IF found[0] NE '' THEN BEGIN 150 IF keyword_set(firstfound) THEN BEGIN 151 IF found[0] NE '' THEN BEGIN 152 IF keyword_set(firstfound) THEN BEGIN 151 153 IF keyword_set(unique) THEN return, found[uniq(found, sort(found))] $ 152 154 ELSE return, found … … 158 160 ELSE fileout = fileout[1:*] 159 161 ; 160 IF n_elements(fileout) GT 1 THEN BEGIN 162 IF n_elements(fileout) GT 1 THEN BEGIN 161 163 IF keyword_set(unique) THEN fileout = fileout[uniq(fileout, sort(fileout))] 162 164 ENDIF ELSE fileout = fileout[0]
Note: See TracChangeset
for help on using the changeset viewer.