Syed Jahanzaib Personal Blog to Share Knowledge !

January 10, 2013

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

Filed under: Microsoft Related — Tags: , , , — Syed Jahanzaib / Pinochio~:) @ 10:50 AM

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

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

.

Regard’s
Syed Jahanzaib

1 Comment »

  1. Hi ,

    I am unable to install BLAT , it just flashes a disappears.it does not get installed. Is there any specific way . Am I missing on something ? Thanks & Regards Aravinda Rao.V

    ________________________________

    Comment by aravind33 — January 10, 2013 @ 10:39 PM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: