function extract_fid, filenames, times=times, fidfound=fidfound, $
              notime=notime, pattern=pattern

break_file, filenames, flog, fpath, fname, fext, fver
wnull = where( fext eq '', nnull)
if nnull ge 1 then fext(wnull) = strarr(nnull) + '.'
;if fext(0) eq '' then fext=strarr(n_elements(fext))+'.'
full_files=fname + fext + fver

fids=extract_fids(full_files, fidfound=fidfound, pattern=pattern)   ; call optimized routine

if fidfound then begin
   if not keyword_set(notime) then times=file2time(fids,out_style='yohkoh')
endif else begin
   box_message,'Could not find FIDs in all files'
   fids=full_files
endelse
if n_elements(fids) eq 1 then fids=fids(0)
return,fids
end