
15/12/2005, 13:46
|
| | Fecha de Ingreso: abril-2005
Mensajes: 71
Antigüedad: 20 años, 1 mes Puntos: 0 | |
Cambiar nombre de archivo y eliminar Hola a todos!
Quisiera saber si alguien me puede ayudar con esto. Estoy utilizando un archivo para agregar y quitar informacion, y necesitaba renombrar un archivo y eliminar otro, alguien sabe, el codigo que uso es este, pero no agrega nada <%
boton = request.Form("boton") Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
'BORRAR email
emails = Trim(request.Form("emails"))
response.Write("www" & emails & "www<br>")
'Verifico la existencia del archivo antes de hacer cualquier cosa
if oFSO.FileExists( Server.MapPath("../info/lista_mpi.txt") ) then
Set oListado_r = oFSO.OpenTextFile( Server.MapPath("../info/lista_mpi.txt"), 1 ) '1 forReading 2 forWriting 8 forAppending
Set oListado_w = oFSO.CreateTextFile( Server.MapPath("../info/lista_mpi.tmp"), true) 'true determina la sobre escritura del archivo
i = 0
Do While Not oListado_r.AtEndOfStream 'leo linea x linea (considero que habra unas 200 lineas por eso no cargo todo)
email = oListado_r.ReadLine
if i <> cint(emails) then
oListado_w.WriteLine email
end if
i = i + 1
Loop
oListado_r.close
oListado_w.close
oListado_r = Nothing
oListado_w = Nothing
Set oArchivo = oFSO.GetFile( Server.MapPath("../info/lista_mpi.txt") )
oArchivo.Delete(true) 'true forza a borrarlo por mas que sea de solo lectura
Set oArchivo = Nothing
Set oArchivo = oFSO.GetFile( Server.MapPath("../info/lista_mpi.tmp") )
oArchivo.Name ("lista_mpi.txt")
Set oArchivo = Nothing
else
response.Write("<div align='center'><b>SIN REGISTROS:</b> aun no se han agregado destinatarios a la lista</div>")
end if %> |