; ; ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; + + ; + FUNCTIONS & PROCEDURES + ; + + ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; ; ; pro sep_pathflnm,path_name,path,flnm,flext ; separate path, filename and extension from the whole path to file path_name if(!version.os_family eq 'unix') then dir_separator='/' if(!version.os_family eq 'Windows') then dir_separator='\' posls=strpos(path_name,dir_separator,/reverse_search) path=strmid(path_name,0,posls+1) flnmwh=strmid(path_name,posls+1) pospt=strpos(flnmwh,'.',/reverse_search) flnm=strmid(flnmwh,0,pospt) flext=strmid(flnmwh,pospt+1) end ; ; ; ; ; ; ; ; ; ; +++++++++++++++++++++++++++++++++++++++++ ; + + ; + MAIN CODE + ; + + ; +++++++++++++++++++++++++++++++++++++++++ ; ; ; ; fldir=dialog_pickfile(/directory,path='c:\MFS_zpracovani',$ title='select directory containing files to be renamed') ; print,' ' print,'Selected directory: '+fldir for jj=0,5 do print,' ' sw_fldigest=' ' print,'============================================' print,'1) ... take all *.fts, *.FTS and *.fits files from ' print,' the selected directory (default)' print,' ' print,'2) ... chose individual files from the selected di-' print,' rectory' print,' ' read,sw_fldigest csw_fldigest=where(sw_fldigest eq ['1','2']) if(csw_fldigest[0] eq (-1)) then sw_fldigest='1' ; if(sw_fldigest eq '1') then begin srch_specfs=fldir+['*.fts','*.fits'] fl=file_search(srch_specfs,/fully_qualify_path,count=nfl) endif if(sw_fldigest eq '2') then begin fl=dialog_pickfile(/multiple_files,path=fldir) nfl=n_elements(fl) endif ss1=strarr(nfl) if(nfl gt 0) then begin print,' ' print,strcompress(string(nfl),/remove_all)+' FITS-files found.' for i=0,nfl-1 do begin sval=fl[i] sep_pathflnm,sval,v_sval1,v_sval2,flext ss1[i]=v_sval2 endfor ; fladdstr='' datestring='' print,' ' print,'1 ....... H_alpha slit-jaw images [default]' print,'2 ....... H_alpha spectrum' print,'3 ....... spectrum of IR CaII line (CaII 8542.1 A)' print,'4 ....... spectrum of MgI 5172.7 A' print,'5 ....... spectrum of D3 (HeI 587.6 A)' print,'X ....... exit' print,' ' odp=' ' read,odp odp=strupcase(odp) ov=where(odp eq ['1','2','3','4','5','X']) if(ov[0] eq (-1)) then odp='1' if(odp eq 'X') then goto,eoftcprmnj print,'datestring in the form YYMMDD' read,datestring,prompt='datestring: ' datestring=strcompress(datestring,/remove_all) ; if(odp eq '1') then fladdstr='SJHa_' if(odp eq '2') then fladdstr='Halp_' if(odp eq '3') then fladdstr='Ca2_8542_1A_' if(odp eq '4') then fladdstr='Mg1_5172_7A_' if(odp eq '5') then fladdstr='D3_' ; fldirout=dialog_pickfile(/directory,title='select directory where renamed files are to be stored',$ path='c:\MFS_zpracovani\') ; for i=0,nfl-1 do begin flout='' if(strlen(datestring) gt 0) then begin flout=fldirout+fladdstr+datestring+'T'+ss1[i]+'.fts' endif else begin flout=fldirout+fladdstr+ss1[i]+'.fts' endelse file_copy,fl[i],flout,/verbose endfor endif else begin print,' ' print,'No FITS-files in the selected directory!!!' print,' Exiting ...' print,' ' endelse ; ; eoftcprmnj: end