Saturday 19 January 2013

Personnel short notes for BLAT and Delete Files Older then X Days

Post : Personnel short notes for BLAT and Delete Files Older then X Days
URL : http://aacable.wordpress.com/2013/01/10/personnel-short-notes-for-blat-and-delete-files-older-then-x-days/
Posted : January 10, 2013 at 10:50 AM
Author : Syed Jahanzaib / Pinochio~:)
Tags : blat, email using BLAT, forfiles, howto delete files older then x days
Categories : Microsoft Related
To send email from windows command using your local company SMTP , use BLAT tool.
BLAT guide.
A wonderful guide is already available here.
http://cybergav.in/2010/10/28/how-to-send-emails-using-blat/
+++++++++++++++
First Download BLAT from following URL:
http://sourceforge.net/projects/blat/files/Blat%20Full%20Version/32%20bit%20versions/Blat%20v3.0.0/blat300_32.full.zip/download?use_mirror=autoselect (http://sourceforge.net/projects/blat/files/Blat%20Full%20Version/32%20bit%20versions/Blat%20v3.0.0/blat300_32.full.zip/download?use_mirror=autoselect)
Unzip it to any folder you like.
+++++++++++++++
To install SMTP in BLAT use the below command . . .
blat -installSMTP 10.0.0.1  your-user-id@xyz.com.pk  5  25
+++++++++++++++
To send email using blat command, use the below command
blat -s "test mail" -i "test" -to  your-user-id@xyz.com.pk
+++++++++++++++
To send email with attachment of file using blat command, use the below command
blat -s "test mail" -i "Syed Jahanzaib / Admin" -to your-user-id@xyz.com.pk -body "Please see attached file" -attach c:\test.txt
+++++++++++++++
Email/Delete Files OLDER then X days Examples:
CORE EXAMPLE
forfiles -p "C:\test" -s -m *.* -d 0 -c "cmd /c c:\blat\blat.exe -to your-user-id@xyz.com.pk -i myname -s INFRA_LOGS -body INFRA_SERVERS_LOGS -attach @path"
Working EXAMPLE for file_server/ For TAPE BACKUP LOGS
forfiles -p "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data" -s -m *.* -d 0 -c "cmd /c c:\blat\blat.exe -to your-user-id@xyz.com.pk -i myname -s INFRA_LOGS -body INFRA_SERVERS_LOGS -attach @path"
TO show (DELETE removed from syntax) FILES OLDER THEN X DAYS (in the below example its 30 days)
FORFILES /p c:\temp /d -30 /m * /c "cmd /c echo @file"
TO show (DELETE removed from syntax) FILES For TODAY
FORFILES /p c:\temp /d 0 /m * /c "cmd /c echo @file"
Windows 2003/7/2008 already have forfiles installed. but you can download it from here http://www.ipass.net/davesisk/forfiles.zip




















No comments:

Post a Comment