Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/02/2007, 08:57
monkyta
 
Fecha de Ingreso: noviembre-2005
Mensajes: 658
Antigüedad: 19 años, 6 meses
Puntos: 3
Re: cachar errores de archvos :S

ASI

' Valida si existe carpeta, si no existe la crea

On Error Resume Next

set fso = CreateObject("Scripting.FileSystemObject")
if err <> 0 then
msg = "*** ERROR AL CREAR OBJETO FileSystemObject : " & hex(err.number) & " - " & err.description & " ***"
llamalog()
end if

if fso.FolderExists(nm_directorio) then
msg = " *** ERROR : DIRECTORIO A CREAR YA EXISTE *** "
llamalog()
else
set directorio = fso.CreateFolder(nm_directorio)
if err <> 0 then
msg = "ERROR AL CREAR DIRECTORIO : " & hex(err.number) & " - " & err.description & " ***"
llamalog()
end if
end if

' Crea Archivo asociado a carpeta

set file =fso.CreateTextFile(nm_directorio & "\" & frm_carpeta & ".txt",True)
if err <> 0 then
msg = "ERROR AL CREAR ARCHIVO : " & hex(err.number) & " - " & err.description & " ***"
llamalog()
end if

file.Write("Carpeta : " & frm_carpeta & " creada el :" & now & " por : " & Session("LOGIN"))
file.close


' Carpeta creada con exito

session("msg") = "*** CREACION DE CARPETA EXITOSA ***"
response.redirect "edm_mensaje.asp?pagina=edm_crear_carpeta.asp"