elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: [1]
1  Programación / Scripting / Re: Borrar Log de una carpeta en: 12 Febrero 2013, 19:05 pm
Muchas gracias me quedo perfecto.

lo agrego por si a alguien le interesa

Código
  1. Option Explicit
  2. on error resume next
  3. Dim oFSOLog
  4. Dim oFSOProc
  5. Dim sDirectoryPathLog
  6. Dim sDirectoryPathProc
  7. Dim oFolderlog
  8. Dim ofolderProc
  9. Dim oFileCollectionlog
  10. Dim oFileCollectionProc
  11. Dim oFile
  12. Dim iDaysOld
  13.  
  14.  
  15.  
  16. 'Personaliza los datos que necesita modificar
  17.  
  18. iDaysOld = 30
  19. Set oFSOLog = CreateObject("Scripting.FileSystemObject")
  20. sDirectoryPathLog = "D:\Archivos de Programa\Exchsrvr\Zilicom"
  21.  set oFolderLog = oFSOLog.GetFolder(sDirectoryPathLog)
  22. set oFileCollectionLog = oFolderLog.Files
  23.  
  24. 'si existen archivos mayores a (x) dias, se eliminaran.
  25.  
  26. For each oFile in oFileCollectionLog
  27.  If oFile.DateLastModified < (Date() - iDaysOld) _
  28.  And LCase(oFSOLog.GetExtensionName(oFile.Name)) = "log" _
  29.  And not LCase(oFile.Name) = "res1.log" _
  30.  And not LCase(oFile.Name) = "res2.log" Then
  31. oFile.Delete(True)
  32.  End if
  33. Next
  34.  
  35. 'Clean up
  36. Set oFSOLog = Nothing
  37. Set oFSOProc = Nothing
  38. Set oFolderLog = Nothing
  39. Set oFolderProc = Nothing
  40. Set oFileCollectionLog = Nothing
  41. Set oFileCollectionProc = Nothing
  42. Set oFile = Nothing

lo unico que tienen que cambiar es la cantidad de dias
2  Programación / Scripting / Borrar Log de una carpeta en: 12 Febrero 2013, 17:50 pm
Buenas, como estan.

Mi paso por aca es que solicito de ustedes una ayuda, ya que soy nob en esto.

tengo este script.

Código
  1. Option Explicit
  2. on error resume next
  3. Dim oFSOLog
  4. Dim oFSOProc
  5. Dim sDirectoryPathLog
  6. Dim sDirectoryPathProc
  7. Dim oFolderlog
  8. Dim ofolderProc
  9. Dim oFileCollectionlog
  10. Dim oFileCollectionProc
  11. Dim oFile
  12. Dim iDaysOld
  13.  
  14.  
  15.  
  16. 'Personaliza los datos que necesita modificar
  17.  
  18. iDaysOld = 15
  19. Set oFSOLog = CreateObject("Scripting.FileSystemObject")
  20. sDirectoryPathLog = "D:\Prueba"
  21.  set oFolderLog = oFSOLog.GetFolder(sDirectoryPathLog)
  22. set oFileCollectionLog = oFolderLog.Files
  23.  
  24. 'si existen archivos mayores a (x) dias, se eliminaran.
  25.  
  26. For each oFile in oFileCollectionLog
  27.  If oFile.DateLastModified < (Date() - iDaysOld) _
  28.  And LCase(oFSOLog.GetExtensionName(oFile.Name)) = "log" Then
  29.   oFile.Delete(True)
  30.  End If
  31. Next
  32.  
  33. 'Clean up
  34. Set oFSOLog = Nothing
  35. Set oFSOProc = Nothing
  36. Set oFolderLog = Nothing
  37. Set oFolderProc = Nothing
  38. Set oFileCollectionLog = Nothing
  39. Set oFileCollectionProc = Nothing
  40. Set oFile = Nothing

Como verán lo que hace es borrar los logs de una carpeta desde una determinada fecha hacia atras, con esto lo que quiero hacer es borrar los log que tiene la carpeta del Active Directory. Pero hay un tema que necesito resolver, que hay un log en especial que no deseo que se borren ya que si lo hace no levantaria las DB que son res1.log y res2.log que tienen fecha muy por debajo de la fecha de eliminacion.

Si podrian ayudarme a resolver este inconveniente se los agradecere infinitamente :D

Muchas gracias de antemano
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines