Computing.Net > Forums > Programming > Hi, need one help!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Hi, need one help!!

Reply to Message Icon

Name: aveenkumarp
Date: June 1, 2009 at 20:38:11 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

Hi buddy, I am Aveen. Let me explain what I in need of?

I need to write a batch file to search whether particular file is exist ina folder using file name format. We have a system which generates some reports daily by 5pm. Just our batch code shout check whether that file is generated? If generated it should send a mail to group we specify and if not present then also it should send mail.

File Name will be like this

LSR_REPORT_ddmmyy

Where ddmmyy is current datetimeyear.

Its really in damn urgent. Could you please reply to my mail ID TheAveen@gmail.com

Your help will be very much appreciable..

Yours
Aveen



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 3, 2009 at 01:31:21 Pacific
Reply:

If the file[s] are in c:\files, this will list the files with that naming convention.

You need to decide on what basis which email will be sent. Do you have a command line email client?

==========================
@echo off & setLocal EnableDelayedExpansion

pushd c:\files

for /f "tokens=* delims=" %%a in ('dir /b LSR_REPORT*.*') do (
echo %%a
)


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: aveenkumarp
Date: June 3, 2009 at 01:42:34 Pacific
Reply:

Hi friend, Thanks for the reply.

I sent u private mail explaining the issue in details..

Okay let me explain you again..

We have a system which generates daily report in .xls format 5pm exactly for 20 customers.

Actually the report is generating in Unix system then it transfers to the Windows box.

After transferring to unix box The fine name format will be look like this day_CustName_LSR_YYYYMMDD.xml

LSR is the contant value and YYYYMMDD is the date of creation of file.Actually the yersterday report will get generate today. Mean to say if today is 03/06/2009,

we will have Wed_SBC_LSR_20090602.XML file.

The batch script should check whether the file is created for the date. If no it should send a alert mail SAY, aveen@xyz.com. Actually I am bit new to batch script file and I seen your posts. Could you please help on this.

Waiting for your reply.
Aveen


0

Response Number 3
Name: aveenkumarp
Date: June 3, 2009 at 01:47:32 Pacific
Reply:

Please gimme the script which fulfils my requirement for 1 cust so that I can run that script indivisually for all customers.

And also I need that script to run automatically at specific time say 5:15PM [Report files are generating by 5PM for all customers] so that It can confirm all report files are generated for all customers.

Regards,
Aveen


0

Response Number 4
Name: aveenkumarp
Date: June 3, 2009 at 01:51:56 Pacific
Reply:

This is the OS and DOS version I am using

Microsoft Windows XP [Version 5.1.2600]


0

Response Number 5
Name: David Perry
Date: June 3, 2009 at 09:59:14 Pacific
Reply:

SETLOCAL ENABLEEXTENSIONS

For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set dow=%%i
set %%a=%%j
set %%b=%%k
set %%c=%%l
set hh=%%m
set min=%%n
set ss=%%o
)
)
set YYMMDD=%yy%%mm%%dd%
set FILENAME=%dow%_SBC_LSR_%YYMMDD%.xml
rem echo %FILENAME%
if not exist %FILENAME% goto MAILNOTIFY


0

Related Posts

See More



Response Number 6
Name: aveenkumarp
Date: June 4, 2009 at 00:15:56 Pacific
Reply:

Hi Friend,

Thank you very much for your reply.

Your code is just generating the output as I expected. But I have issue in this. Code is just displaying the output on command prompt when I run that.

Actually, it need just to check whether the file is created with the current date. If so no need to prompt any message if no, as you mentioned control should move to MAILNOTIFY

Can you provide the scripts to send the mail to a specific mail ID ??

It will be very helpfull..
Sorry if I borthering U much,

Waiting for your reply..

Aveen


0

Response Number 7
Name: aveenkumarp
Date: June 4, 2009 at 00:28:04 Pacific
Reply:

Here is the output I am getting!!

F:\qa>a.bat

F:\qa>SETLOCAL ENABLEEXTENSIONS

F:\qa>For /F "tokens=1-7 delims=:/-, " %i in ('echo exit|cmd /q /k"prompt $
') do (
For /F "tokens=2-4 delims=/-,() skip=1" %a in ('echo.|date') do (
set dow=%i
set %a=%j
set %b=%k
set %c=%l
set hh=%m
set min=%n
set ss=%o
)
set FILENAME=_SBC_LSR_.xml
if not exist goto MAILNOTIFY
)

F:\qa>(
For /F "tokens=2-4 delims=/-,() skip=1" %a in ('echo.|date') do (
set dow=Thu
set %a=06
set %b=04
set %c=2009
set hh=12
set min=55
set ss=44.62
)
set FILENAME=_SBC_LSR_.xml
if not exist goto MAILNOTIFY
)

F:\qa>(
set dow=Thu
set mm=06
set dd=04
set yy=2009
set hh=12
set min=55
set ss=44.62
)
'MAILNOTIFY' is not recognized as an internal or external command,
operable program or batch file.
F:\qa>


Could you please help me? Whatever the things are displaying here hsould calculate internally and if the file is not generated with todays date then the control should send an e-mail to a specifid mail ID.

If this works fine it will be very helpfull for me.

Waiting for your reply.

Aveen


0

Response Number 8
Name: aveenkumarp
Date: June 4, 2009 at 19:03:56 Pacific
Reply:

Hi Buddy, you der?

I am waiting for your reply...

If you need more information please let me know.

Regards,
Aveen


0

Response Number 9
Name: David Perry
Date: June 4, 2009 at 20:40:58 Pacific
Reply:

On windows, you can use the tool "blat" to send mail

http://www.blat.net/

see the docs here:

http://www.blat.net/syntax/syntax.html

I left MAILNOTIFY in there as a stub for you to handle mail as you chose.


0

Response Number 10
Name: aveenkumarp
Date: June 4, 2009 at 20:55:57 Pacific
Reply:

But the code is displaying the search result in screen. I just want those calculation should handle in background. Only if file not present it should send mail. I posted you the output what I am getting when I run the code. Please have a look on that. Once I run it is displaying program, each and everyoutputs.


0

Response Number 11
Name: aveenkumarp
Date: June 7, 2009 at 22:01:12 Pacific
Reply:

Hi Friend, I am looking forward for your reply.

Could you please gimme the update scripts? The script what you have mentioned before displays the outout on screen.

But, the script should check whether the file with current date is present in the folder. If no it should mail that the desired file is not present. Could you please help on this?

Yours
Aveen


0

Sponsored Link
Ads by Google
Reply to Message Icon

Advanced Batch Files Effective tool for run-ti...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Hi, need one help!!

Need programmers help!! www.computing.net/answers/programming/need-programmers-help/2136.html

need the help of a wise human!(c++) www.computing.net/answers/programming/need-the-help-of-a-wise-humanc/7950.html

SQL Server Help www.computing.net/answers/programming/sql-server-help/10797.html