| I would like to read everything in my input folder and output everything to a new folder using the code below. However, I am not sure how to change out_name to get it to do this and if I am doing the correct thing in reading all the files in.
pro outputtoexternalfile
FORWARD_FUNCTION ENVI_OPEN_DATA_FILE  
compile_opt strictarr  
ENVI, /RESTORE_BASE_SAVE_FILES 
;envi_batch_init, log_file='E:\FinalProcessing\GrassValley_Slide\burn_indices\batch.log'
;set up path to input and output files
input_path = 'E:\test090819\in\'
output_path='E:\test090819\out\'
    ; search for data files in the specified directory
    files = FILE_SEARCH(input_path, '*',count=count)
    IF (count EQ 0) THEN BEGIN
  PrintF, 'No files were found to process'
 ENDIF
;open file
   for i=0, count-1 do begin 
    ENVI_OPEN_FILE, files[i], r_fid=refl_fid
     if (refl_fid eq -1) then begin
      envi_batch_exit
      return
     endif
ENVI_FILE_QUERY, refl_fid, ns=ns, nl=nl, nb=nb, data_type=data_type, fname=filename
   pos=lindgen(nb)
   dims=[-1L,0, ns-1, 0, nl-1]
OUT_NAME = output_path+filename+'test'
ENVI_OUTPUT_TO_EXTERNAL_FORMAT, dims = dims, /ESRI_GRID, FID=refl_FID, pos=pos, OUT_NAME=out_name 
endfor
end |