Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

A question regarding how to share parameters between many script files

13th December 2014

I would like to share here a common question that from time to time it is answered via email (you can request tech support in the Contact section):

Dear Support:

Sorry to bother you, I looked at a few forum pages and could not search for ‘include’ (because it was ‘a too common word’).  Just a high-level question in three parts as I am evaluating ScriptFTP:
1) Can I use the equivalent of an ‘#include <stdio.h>’ (C notation) to put common parts of scripts or functions into one place?  All the examples I have seen were in one stand-alone ‘.ftp’ file.
2) If not possible, can I at least make a connection script that I call from another script and use it?
(For example on.ftp is the logon and off.ftp the logoff script, can I have a main.ftp that calls on.ftp, does some FTP stuff and calls off.ftp then?)
3) If 2) works, could I call the three .ftp scripts from a Powershell individually (in sequence)?  Or do I lose the connection as soon as the script is done?

So far I am impressed.  The scripting is easy and straightforward, and from what I’ve read I can combine it with Powershell via command line… The best feature is the return code check after each command during the session.  Good job.

And our answer here:

1) “Including” other script files within a script is not supported, sorry.

2) If you want to share server names, user names etc among many scripts try using GETENV (to retrieve an environment variable where you have stored the FTP server address, for example) or use GETPARAM which retrieves parameters from the command line. I hope this answer your question.

3) The connection is lost but you can call three script sequentially just call ScriptFTP.exe the_script_path.ftp. See ScriptFTP in the command line

 

 


ScriptFTP 4 version released

2nd December 2014

After many months of beta testing the version 4 will finally replace the version 3.3 (Although the old version can still be found in the Attic.

The changes from the version 3.3 are:

  • SFTP support (previously only FTPS and plain FTP were supported)
  • Faster script execution, lower load time.
  • Automatically recover from lost connections and partial file transfers due connection fails.
  • Integration with the task scheduler on newer versions of Windows (7, 8 and 8.1)
  • Many minor changes and small fixes.

Tags