<% 'RUTAZIP="\\abc-nas\d\inetpub\PDF_Depot\Hoy\ABC_MADRID__PORTADA.pdf" 'RUTAZIPSEV="\\abc-nas\d\inetpub\PDF_Depot\Hoy\ABCSEVILLA_PRIMERA__PORTADA.pdf" RUTAZIP="\\estadisticas\d$\PDF_Depot\Hoy\ABC_MADRID__PORTADA.pdf" RUTAZIPSEV="\\estadisticas\d$\PDF_Depot\Hoy\ABCSEVILLA_PRIMERA__PORTADA.pdf" host = Request.ServerVariables("SERVER_NAME") function fechaTxt(fecha) thedia = day(fecha) mes = month(fecha) ano = year(fecha) if len(thedia)=1 then thedia= "0" & thedia if len(mes)=1 then mes= "0" & mes fechaTxt = ano & mes & thedia end function sub toPaTi() on error resume next nombrefichero="Portada_ABC.pdf" if instr(host,"sevilla")>0 then theRuta = RUTAZIPSEV else theRuta = RUTAZIP end if Set fs=server.CreateObject("scripting.filesystemobject") if fs.FileExists(replace(theRuta,"Hoy",fechadir)) then fichero= replace(theRuta,"Hoy",fechadir) else fichero= theRuta end if Set fs=nothing Set objStream=server.CreateObject("ADODB.STREAM") if err.number = 0 then Response.ContentType="application/pdf" Response.AddHeader "Content-Disposition", "attachment;filename=" & nombrefichero end if objStream.Open objStream.Type=1 objStream.LoadFromFile fichero binDump=objStream.Read objStream.Close if err.number<>0 then Response.Write "Error en el dispensador." Response.End end if Response.BinaryWrite binDump Set objStream=nothing end sub if (hour(now)<5 Or (hour(now)=5 And minute(now)<45)) then hoy=date-1 else hoy=date end if fechadir=fechatxt(hoy) call toPaTi %>