Topic "Newbe email notification question"

Author Message
torentine
[View user's profile]

Joined: 2010-05-28
Posts: 2
Location: Monterey California
First of all congratulation on a great product.

Now moving on, I have a folder on my network on which users store lab results. I created a scheduled task which call on WINSCP to automatically upload any new files to remote FTP server and then it moves those files to a different directoy on the local server. All this is working just fine.

The problem is that I also configured email notification for when the job fails. The email portion works a little to well. The problem is that when there are no files to be transfered I get an email with an error notification.

This is what I have as a script which get called on by a batch file.

option batch on
option confirm off
open labresults
put *.*
exit

Please Help
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
OK, but what about the code that sends the email?
_________________
Martin Prikryl
Guest




oh ok after the script runs it calls on a bat file with the following code:

winscp.com /script=MoveLabResults.txt
if errorlevel 1 goto error

echo Upload succeeded, moving local files
move C:\cssw\hl7\emd\Results\*.* c:\backup\

:error
echo Error!
bmail.exe -s 192.168.16.10 -t user@example.com -f Results@example.com -b "FTP File Transfer Failed To SVMH" -a "PCM LabLab Results Transfer Failure"


:end
torentine
[View user's profile]

Joined: 2010-05-28
Posts: 2
Location: Monterey California
I just wish that I wouldnt get a failed email after the job tries to run and there are no files in the directory.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Your batch file misses goto end command after move command, so you get the email even on success.
_________________
Martin Prikryl
lyf

Guest


prikryl wrote:
Your batch file misses goto end command after move command, so you get the email even on success.


I think when WinSCP finds there are no files to upload, it sees this as an error but it is actually perfectly fine since not everytime there will be files to send. So how are we going to differentiate this error from the real problems?

cheers
lyf
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
lyf wrote:
I think when WinSCP finds there are no files to upload, it sees this as an error but it is actually perfectly fine since not everytime there will be files to send. So how are we going to differentiate this error from the real problems?

This is not true.
Your batch file is simply wrong, as I have suggested in my previous post.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License