ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
Hello, i tried scriptFTP for about 1 week an i love it.
But now, before registering, i found one thing thats important for my case:
Is it possibe to send an e-mail (via send-mail-script and blat.exe) only in case of
successfully done transfers?
And only with the SILENT(ON) output like:
Uploading (remote file is older) Lautest_41950\Testlayout\Lautest_41950_Testlayout_#41960#.indd
Uploading (remote file is older) Lautest_41950\Testlayout\Lautest_41950_test_03_#42000#.eps
Downloading (local file not found) Lautest_41950_112167.eps_#42020# Kopie.eps.lay.eps
Deleting remote file.......... Lautest_41950_112167.eps_#42020# Kopie.eps.lay.eps
Best Regards
Richard
Hello Richard,

Thanks for the good feedback :D

Yes, it's possible. You have to retrieve the returned value by SYNC, GETFILE or PUTFILE this way:
Code: Select all$my_returned_value=SYNC(.......)
Then, if the value is "OK" means that the transfer was done without errors:
Code: Select allIF($my_returned_value=="OK")  EXEC($blat_cmd_line_to_send_an_email_here") END IF
The SILENT command is only used to hide some ScriptFTP messages. It won't affect the way the script is run, in other words, it will send the email even if silent is activated.

Some links that you may find useful:

Sending emails from within a script http://www.scriptftp.com/reference.php?go=topic123
Retrieving commands result: http://www.scriptftp.com/reference.php?go=topic310

(You probably already read the first topic, but I put here for reference)

If you have any further questions or need more help feel free to post here again.
Hello, and thanks for the fast reply.

I am aware of how to retrieve command results.But what i did not manage up to now is to
have the LOG-Output inside a variable to paste it into the body of the e-mail.
As far as i found out the result of a command is "OK" or the Error-Message if something went wrong.
What i want to do is:
1. check if the transfer was successfull
- thats done by retrieving the command-result
2. if it was successfull
- get the LOG-Output into a var to place ist as the body-part inside the blat-commandline.

Best Regards
Richard
Hello Richard,
- get the LOG-Output into a var to place ist as the body-part inside the blat-commandline.
It's not possible to send the script output as part of the message body because the log is stored in a file, not a variable. Future versions of ScriptFTP will include commands to read a file and store its contents in a variable.

However, you can send it as an attachment using the -ps parameter of blat.exe. The help topic "Sending emails from within a script" has an example of it.

If you need a more detailed explanation or anything else just post again.
Hello i registered scriptFTP today ;)

One question regarding my E-Mail topic again:

Am i right that SYNC(....) returns "OK" even if nothing was synced because there was nothing to sync?
If so how can i check if something raelly has benn transfered?
Because i only want to send an E-Mail in case of successfully done transfers.

Best Regards
Richard
Hello Richard,

Thanks for purchasing ScriptFTP.

Download and install ScriptFTP again from here:

http://www.scriptftp.com/ScriptFTP_3_0_setup_devel.exe

I've added to ScriptFTP a new command to allow you to check how many files have been transfered. Use it this way:
Code: Select allSYNC(.....) IF(GETTRANSFEREDFILESCOUNT()>0)  EXEC($blat_cmd_line_to_send_an_email_here) END IF
If you find anything wrong post here again please.
Hello and thank you for the patch!

It works.
But here another problem regarding this case.
With my E-Mail i want to send the actual logfile of this scriptrun.
The Problem is that the logfile is not ready written before the finish of the script.
So blat.exe will send an empty file attached.

Is there a STOP-LOG Function to stop Logging and having the file accessale?
Or:
Is there a chance to concatenate two scripts like:
First-Script is doing all the transfers and is calling a second script
that is doing the mailing?

Best Regards
Richard
Hi Richard,

Some users also reported the same problem and it seems that it's related to how file caching is handled on some version of windows. To address it I've added the command you suggest to stop the file logging: STOPLOG()

I don't know why it hasn't been added before...

Download and install ScriptFTP from here:

http://www.ScriptFTP.com/ScriptFTP_devel_setup.exe
Hello,
it is possible to attach a file as an attachment?
I used a parameter "-ps", but this is not what I need...
for example: zip file

Thanks
Hello Mihcal. Try -attach or -attacht

You can find more information here: http://www.blat.net/syntax/
it works great
Thanks