How to Automate SFTP Downloads on the MFT Server | JSCAPE

Learn how to set up automated SFTP download online at JSCAPE today! This guide features 5 practical examples for setting it up with our MFT Server.
  1. Blog

Overview

An automated SFTP download is one of the most efficient ways of downloading data from a remote server over a secure, encrypted channel. It's ideal for enterprise-class transactions and data exchanges that require outstanding levels of speed, security, and accuracy. In this post, we're going to show you several ways of doing this type of download on JSCAPE MFT Server.


If you want to follow this post but aren't using JSCAPE MFT Server, I suggest you download the free, fully functional edition from here:

For instructions on how to install, you may follow these links:

The Online Documentation

Article: Install A Linux SFTP Server Via Command Line and Configure Via Web UI

Article: How To Install A SFTP Server on Windows

Everything up and running? Let's begin.

Setting up an automated SFTP download on JSCAPE MFT Server is easy. You'll have at your disposal a GUI-based suite of automation-enabling features collectively known as Triggers.

For more examples showcasing the use of triggers, just click that link.

Let's start with the first example.

SFTP File Download

automated_sftp_file_download.png

Through the use of triggers, you can set up an automated SFTP download that activates in response to certain events, e.g. a recent file upload, a file deletion, a user login, a file modification, a client attempt to change its working directory, and many others.

Each event is accompanied by a selection of event variables whose values are set when the event is raised. For example, some of the variables set when the File Upload event is raised include:

  • LocalPath - the server local path of the file uploaded
  • DayOfMonth - the current day of the month when the upload was made
  • ClientIP - the IP address of the client that sent the upload request
  • ServerIP - the IP address of the server network interface on which the request was received

These are just a few examples. There are a lot more. In addition to those variables, each trigger also comes with a collection of functions that can be used to format or parse trigger event variables. There functions that add numeric variables, concatenate strings, check whether a file exists, retrieves a substring, obtains a user's information, and so on.

Selecting a trigger event type

sftp_file_download_trigger_event.png

The most common type of automated file transfer is one that activates on a predefined schedule, say every Friday at 9pm or every first day of the month. You can set one up by creating a trigger that responds to the Current Time event type and then define a schedule in the Trigger Conditions box.

We won't go into the details of those settings since we've already discussed those thoroughly in the post...

Benefits of a Scheduled File Transfer and How To Set One Up

Once you've configured the event type and trigger conditions, the next part would be to add a trigger action. For our first example, we'll just download a single file. This can be accomplished through the SFTP File Download trigger action.

add_sftp_file_download.png

After proceeding to the next screen, enter the required trigger action parameters. This would typically include the following:

  • Hostname - The SFTP/SSH server hostname or IP address.
  • Port - The port number of the remote SFTP service. This is normally 22.
  • Username - The username of a valid account on the remote server. This account must have access to the file you intend to download.
  • Password - The password associated with that account
  • Remote File - The relative path (relative to the account's root directory) of the file you intend to download
  • Local File - The absolute path of the file where you want the downloaded file to be stored.
sftp_file_download.png

Click the OK buttons until you're back at the main screen and you're done.

Doing SFTP File Downloads from Multiple Sources

sftp_download_multiple_sources.png

You may even download separate files from multiple remote servers. Just add more SFTP File Download trigger actions, each with its own set of parameters.

add_more_sftp_file_download.png

SFTP Regex File Download

scheduling_automated_file_transfers_regex-resized-600.png

Sometimes, you'll want to download multiple files from the same remote host. If those files have something in common, e.g. their filenames have the same filename extensions, contain similar substrings, begin with the same letter, include a certain set of alphanumeric characters, and so on, then the best way to download these files would be through the SFTP Regex File Download trigger action.

As its name implies, this trigger action accepts regular expressions (a.k.a. regexes). This 2-part article offers a nice introduction on the subject...

Using Regular Expressions in Triggers

The SFTP Regex File Download trigger action accepts the following parameters.

sftp_regex_file_download_parameters.png

At the minimum, you'll need to specify the following fields:

  • Hostname
  • Username
  • Password
  • Regular Expression
  • Remote Directory - this is the relative path of the remote directory that holds the files you intend to download.
  • Local Directory - this is the local directory where the downloaded files will be stored

If you need more examples featuring the use of triggers, click that link. That leads to multiple pages, so feel free to click the link that says "Next page" at the bottom of the first page to view more.

SFTP Directory Download

sftp_directory_download.png

To download an entire directory, use the SFTP Directory Download trigger action.

In addition to the Hostname, Username, and Password fields that you needed to specify in the other trigger actions we discussed earlier, the SFTP Directory Download trigger action also requires you to specify the Remote Directory you wish to download as well as Local Directory where you intend to store it in.

Using a Trading Partner

Earlier, in the section entitled "Doing SFTP File Downloads from Multiple Sources", we outlined how you can set up multiple downloads from various remote hosts. If think about it, you'll realize how tedious it would be to enter parameters for every single trigger action.

It can get even more tedious if you have multiple triggers involving SFTP uploads/downloads to the same remote servers. It would be much easier if you could store certain parameters (e.g. hostname/IP address, port number, username, and password) into some object which you can then retrieve when it's time to enter trigger action parameters.

This article elaborates on the problem and the solution offered by JSCAPE MFT Server:

Preparing Trading Partner Servers For SFTP Automation

Once you've defined a Trading Partner for a particular SFTP service, you can then simply select it when entering trigger action parameters. For example, let's say you've assigned a particular SFTP service to the trading partner named "Trading Partner 1".

So, when you enter trigger action parameters for the trigger action Trading Partner File Download, you no longer have to enter parameters like the hostname/IP address, port number, username, and password. You just need to select the trading partner in question like this:

sftp_trading_partner_file_download.png

Did you enjoy this post? You might want like these articles too.

Related posts

Setting Up Public Key Authentication Between Trading Partners

You Know It’s Time To Implement Server To Server File Transfer When..

How To Set Up A HTTPS File Transfer

AS2 Simplified