dir=ToFileName[{"e:\\public_html\\pictures\\archives"}]; (****** Change these lines **********) minyear=maxyear=2000; minroll=114; maxroll=114; (************************************) Do[ (* year *) year=ToString[nyear]; Do[ (* roll *) roll=ToString[nroll]; dirroll=ToFileName[{dir,year,roll}]; If[SetDirectory[dirroll]<>"\\"!=dirroll,Goto[1]]; browser=ToFileName[dirroll,"browser.htm"]; browser0=ToFileName[dirroll,"browser0.htm"]; data=ReadList[browser0,String]; mlines=Length[data]; ob=OpenWrite[browser,PageWidth->Infinity]; Do[line=data[[nline]]; line1=StringReplace[line,{"=\"jpeg/"->"=\"../../compress/"<>year<>"/"<>roll<>"/",".jpg\">"->".htm\">"}]; Write[ob,line1//OutputForm]; ,{nline,mlines}]; Close[ob]; Label[1],{nroll,minroll,maxroll}],{nyear,minyear,maxyear}];