Документ взят из кэша поисковой машины. Адрес оригинального документа : http://lnfm1.sai.msu.ru/~kupry/SOFTWARE/renameMFSfiles_v2.0win.pro
Дата изменения: Sun Oct 9 22:59:12 2011
Дата индексирования: Mon Oct 1 23:05:21 2012
Кодировка:

Поисковые слова: п п п п п р п р п п р п р п п п п п п п п п р п р п п п п р п р п п
;
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; + +
; + 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)
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 ....... slit-jaw images [default]'
print,'2 ....... H_alpha spectrum'
print,'X ....... exit'
print,' '
odp=' '
read,odp
odp=strupcase(odp)
ov=where(odp eq ['1','2','X'])
ov=ov[0]
print,'datestring in the form YYMMDD'
read,datestring,prompt='datestring: '
datestring=strcompress(datestring,/remove_all)
;
if(ov eq (-1)) then odp='1'
if(odp eq '1') then fladdstr='SJ_'
if(odp eq '2') then fladdstr='Halp_'
if(odp eq 'X') then goto,eoftcprmnj
;
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+'_'+ss1[i]+'.fts'
endif else begin
flout=fldirout+fladdstr+ss1[i]+'.fts'
endelse
file_copy,fl[i],flout,/verbose
endfor
;
;
eoftcprmnj:
end