function find_newest_nugget spawn,'pwd',pwd0 cd,'/home/www/sxt_co' ; cd,'/net/notung/usr/people/nitta/idlpro/sxt_co_dummy' spawn,'ls -1t *.html',infil ; -1 (one means one output per line) nt=n_elements(infil) flen=intarr(nt) ft=strarr(nt) for i=0,nt-1 do flen(i)=strlen(infil(i)) for i=0,nt-1 do ft(i)=strmid(infil(i),0,2) ss=where(flen eq 11 and $ (ft eq '97' or ft eq '98' or ft eq '99' or ft eq '00' or ft eq '01' or $ ft eq '01' or ft eq '02' or ft eq '03' or ft eq '04' or ft eq '05' or ft eq '06'), ns) print,fix(ns),' files meet the criteria (11 characters and start with yy)' out=infil(ss(0)) print,' the newest file (on the basis of update times) is: ',out file=infil(ss) secarr=lonarr(ns) for i=0,ns-1 do begin yy=fix(strmid(file(i),0,2)) mm=fix(strmid(file(i),2,2)) dd=fix(strmid(file(i),4,2)) time=anytim2ints([0,0,0,0,dd,mm,yy]) secarr(i)=int2secarr(time,'30-aug-91') endfor sss=sort(secarr) out2=file(sss(ns-1)) print,' the newest file (on the basis of file names) is: ',out2 print,' unless sxt_co names the newest nugget in a funny way, this is more' print,' legitimate, so the one on the basis of file names is returned.' cd,pwd0(0) return,out2 end