Correo desde linea comandos en windows

19 11 2009

Desgraciadamente en windows no disponemos del maravilloso comando sendmail o mail.

En windows tenemos varias opciones todas con una pinta de mierda , pero “funcionan”.

Postie es una de ellas funciona a partir de windows xp , no esta mal.

Luego tenemos el famoso Blat que no me mola ni el nombre xD.

Y finalmente hemos usado el bmail que si funciona en windows NT/2000 es una autentica mierda de 17 KB pero hace su funcion correctamente.





Pequeño script matutino

19 11 2009

Tiene un arbol de directorios llenos de ficheros de log  creados hoy y quiere saber en que archivo esta el log o el dato de texto que necesita, a mi me ha pasado eso mismo esta mañana y me hecho este aborto de script:

'Busca una ocurrencia de texto en ficheros de logs dentro de un arbol de directorios dados.
'
'
'
basedir="E:\XXXXXX\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubfolders FSO.GetFolder(basedir)


Sub ShowSubFolders(Folder)
 For Each Subfolder in Folder.SubFolders
 
 Set objFolder = objFSO.GetFolder(Subfolder.Path)
 searchfile(objFolder)
 ShowSubFolders Subfolder
 Next
 Set Objfolder = Nothing
End Sub


Sub searchfile(folders)
 Set colFiles = folders.Files
 For Each objFile In colFiles
 Set found = objFSO.GetFile(objFile.path)
 foundcreated=found.DateLastModified 
 extension=Split(found.path,".")
 If  day(date()) = day(foundcreated) AND month(date()) = month(foundcreated) AND year(date()) = year(foundcreated) Then
 If extension(1) = "log" Then 
 'Busca en un path una ocurrencia de texto.
 search_text(found)
 End if 
 End if 
 Next

End sub 


Sub search_text(filefind)
'    wscript.echo filefind.path
 match="Error"
 Set objFSO_search = CreateObject("Scripting.FileSystemObject")
 Set objFile_search = objFSO_search.OpenTextFile( filefind.path , 1)
 strSearchString = objFile_search.ReadAll
 objFile_search.Close
 matched=InStr(strSearchString, match)
 If matched > 0 Then
 wscript.echo "Error encontrado en: " & filefind.path 'Blat aqui para avisarnos
 End if 
 Set objFSO_search = Nothing
 set objFile_search = Nothing
 set matched = Nothing 
End sub

Espero que les sea de utilidad algun dia para alguien….








Seguir

Get every new post delivered to your Inbox.