
06/11/2007, 09:16
|
| | Fecha de Ingreso: junio-2007
Mensajes: 40
Antigüedad: 17 años, 11 meses Puntos: 0 | |
Re: ayuda con codigo kiero renombrar archivos, es decir, el usuario borra un archivo llamado 2.jpg y los k ay despues 3.jpg y 4.jpg(x ejemplo puede aber mas o ninguno) pasen a ser 2.jpg y 3.jpg, y estoy un poco perdida con el codigo si alguien me pudiera pasar codigo de ejemplo. yo tengo algo echo pero solo cambia el nombre del archivo siguiente al k se borra,y si ay mas los deja igual ahi mi problema, dejo mi codigo a ver si alguien me puede ayudar.
if Request.QueryString("a") <> "undefined" then
narchivo = Request.QueryString("a")
else
response.redirect("index.asp")
End if
if Request.QueryString("num") <> "undefined" then
idreg = Request.QueryString("num")
else
response.redirect("index.asp")
End if
carpeta = "dbc/A_D/cal/html/websolmod/archivos/obras"
cad = split(narchivo,".")
numeAnt = cad(0) + 1
numeNew = cad(0)
NombreAnterior = numeAnt&".jpg"
NombreNuevo = numeNew&".jpg"
archivo = "/"& carpeta &"/"& idreg &"/"& narchivo
if archivo <> "" then
set FSO = Server.CreateObject("Scripting.FileSystemObject")
set Fich = FSO.Getfile (Server.MapPath(archivo))
Fich.Delete
End if
Set FSO2 = Server.CreateObject("Scripting.FileSystemObject")
if FSO2.FileExists(Server.MapPath("/"& carpeta &"/"& idreg &"/" & NombreAnterior)) = True then
Set Fich2 = FSO2.GetFile(Server.MapPath("/"& carpeta &"/"& idreg &"/" & NombreAnterior))
Call Fich2.Copy(Server.MapPath("/"& carpeta &"/"& idreg &"/"& NombreNuevo))
Call Fich2.Delete()
End if
Set Fich2 = Nothing
Set FSO2 = Nothing
es un pokito urgente, gracias |