<%
rootnere="../../"
databasedizininere="databases/"
mainfile=request("n")
temprorryex=datediff("d",+1,now)
sFileFrom = Server.MapPath(""&rootnere&""&databasedizininere&""&mainfile)
sFileTo = Server.MapPath(""&rootnere&""&databasedizininere&""&mainfile&"."&temprorryex&".mdb")
sConnFrom = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & sFileFrom
sConnTo = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & sFileTo
set jro = server.createobject("jro.JetEngine")
jro.CompactDatabase sConnFrom, sConnTo
If err<>0 Then
response.write"Error Compacting Database:<br/>" & err.description
err.clear
else
Set fso = server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile Server.MapPath(""&rootnere&""&databasedizininere&""&mainfile&"."&temprorryex&".mdb"),Server.MapPath(""&rootnere&""&mainfile&"."&temprorryex&".mdb")
if err <> 0 then
response.write"Error Renaming Tempory File:<br>" & err.description
end if
fso.CopyFile Server.MapPath(""&rootnere&""&mainfile&"."&temprorryex&".mdb"),Server.MapPath(""&rootnere&""&databasedizininere&""&mainfile)
if err <> 0 then
response.write"Error Deleting Tempory File:<br>" & err.description
end if
response.write"Compacted successful."
fso.DeleteFile Server.MapPath(""&rootnere&""&mainfile&"."&temprorryex&".mdb")
end if
Set fso = Nothing
set jro=nothing
%>