Re: troubles with findfile (now with attachment) [message #11263] |
Tue, 17 March 1998 00:00 |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Martin Schultz wrote:
>
> Hello once again,
>
> recently I had a chance to test IDL on two different SGI platforms
> (Power Challenge XL and Origin 200). Things went really well (and fast
> !), but then I came across one bug that diminuished my enthusiasm
> somewhat: using the FINDFILE command would not always return all the
> files matching the search pattern. I wrote a little test program
> (see below) and ran it repeatedly using cursor up, enter, cursor up,
> enter, ... In about half of the tests, findfile did OK, the other half
> it returned a fraction of say 1/3 or 1/4 of all the files it should
> find. Interestingly, in case of the error, it was always the same number
> of files that was found. I never had this problem on any of the AIX
> workstations I worked on. Although it seems to me as if this could have
> to do with the Unix installation rather than with IDL, I'd like to know
> whether anyone else has experienced the same problem (or could run the
> attached test program and find out), and of course I would be most happy
> if someone has already found the answer.
>
> Thanks,
> Martin.
>
> --
> ------------------------------------------------------------ -------
> Dr. Martin Schultz
> Department for Earth&Planetary Sciences, Harvard University
> 186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
>
> phone: (617)-496-8318
> fax : (617)-495-4551
>
> e-mail: mgs@io.harvard.edu
> IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
> ------------------------------------------------------------ -------
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
pro testfilelist,filelist,detail=detail
; ============================================================ =====
; check through filelist and determine which files have to be merged
; ============================================================ =====
if (n_elements(filelist) lt 1) then begin
filelist = '*.dat'
print,'** WARNING : empty filelist ! Will try to merge all .dat files. **'
endif
filenames = ''
for i=0,n_elements(filelist)-1 do $
filenames = [ filenames, findfile(expand_path(filelist(i))) ]
print,'FILENAMES contains ',n_elements(filenames),' elements !'
; first test for all files not found
ind = where(filenames eq '')
if (n_elements(ind) gt 1) then print,n_elements(ind)-1,' filenames empty !'
; now get valid names
ind = where(filenames ne '')
if (ind(0) lt 0) then begin
print,'** ERROR : Could not find any files in filelist ! Return. **'
return
endif
filenames = filenames(ind)
; loop through valid filenames and check if file exists
if (keyword_set(detail)) then begin
for i=0,n_elements(filenames)-1 do begin
if file_exist(filenames(i)) then print,'file ',filenames(i),' found.' $
else print,'file ',filenames(i),' NOT found.'
endfor
print
endif
return
end
|
|
|