Script to Email Confirmation if Latest File Contains Specific String
- From: "basis_consultant@xxxxxxxxxxx" <basis_consultant@xxxxxxxxxxx>
- Date: 23 Nov 2006 12:27:44 -0800
Hello,
We are running SAP and Oracle on Win2000 and Win2003 environments.
As I am not experienced in Windows scripting, I would greatly
appreciate it if somebody could point me in the right direction for a
script which does the following:
We have a directory which contains backup log files for any number of
systems (Depending on the day of week, etc..). The logs are all named
'*.afd' or '*.ald'. If a backup was successful, one of the final lines
in the log file contains the string '100.00' (As in 100%
of files were backed up).
The script is to check for any '*.afd' or '*.ald*' file created in
the previous 24 hours in any subdirectory under a specific drive (Say
'D').
If that file contains the string '100.00', the script should send
an email to a hardcoded address with the name and path of the
log file, as well as a confirmation such as 'Backup likely successful'.
(For example, 'D:\DEV\abclog.afd Backup likely sccessful').
If the log file does not contain the string '100.00', the script
should send an email to a hardcoded address with the name
and path of the log file, as well as a message such as 'Backup
likely failed'.(For example, 'D:\Other\QUA\deflog.afd Backup likely
failed'.).
I realize that this script has many parts (Searching a directory
tree, checking for a specific string in a file, emailing, etc..)
so even ideas on how to do parts of it would be useful.
If possible, I would like to do this using default Windows commands,
without using Perl or other languages.
Thanks in Advance,
BASIS Consultant
.
- Prev by Date: Re: Newbie question - badly formed output from Powershell
- Next by Date: Re: Create text file
- Previous by thread: Re: Script to search for and delete all files with extension xxx
- Next by thread: search eventlog
- Index(es):
Relevant Pages
|