Blog

Managed File Transfer and Network Solutions

How to Automate a SFTP File Transfer | JSCAPE

Posted by John Carl Villanueva on Thu, Dec 03, 2020 @ 01:13 AM

Automated SFTP file transfers are traditionally done through scripts, but there's a much easier way. In this tutorial, we'll show you how to automate SFTP file transfers without writing a single line of code.

To accomplish this task, we'll be using JSCAPE MFT Server, a managed file transfer solution that simplifies business process automation through the use of triggers. Triggers is a comprehensive suite of automation-enabling tools presented in an intuitive graphical user interface. Let's go through this quick tutorial so you can see how it works.  

Watch the video 

Would you prefer to watch a video showing how to automate and SFTP transfer? You can play the video below. Otherwise, just skip it if you wish to continue reading.

For a more comprehensive discussion on triggers, you may refer to the online documentation. But I suggest you do that later. This tutorial will be done in no time and it should be enough to give you a general idea how triggers work. 

I've already logged into the JSCAPE MFT Server administrative web interface and have navigated to the Triggers module. For this example, I'm going to create a trigger that would listen to a specific file movement in my machine's local file system. Once it detects that specific file movement, it will respond by uploading that same file to a remote SFTP service.

Before I create that trigger, let me first show you the trigger responsible for moving the file in question.

 

automate sftp transfer

 

So, as you can see from this trigger's action parameters, the file to be moved is named 'azureblobdownloadfile.txt', and it's going to be moved from 'E:\downloads' to 'D:\testuserfiles'. The trigger we're about to create should only respond to a file movement that involves this particular file and these particular source and destination directories. 

 

automate sftp transfer - 2

 

Let's create that trigger now. To create the trigger, just go to the Triggers module and click the Add button.

 

automate sftp transfer - 3

 

Give this trigger a name, say, 'automate sftp transfer of moved file'. After that, select the 'File Move' Event type. This is the type of event this trigger is supposed to respond to. Note that there are several other event types to choose from. Here's an example that let's a trigger run on a predefined schedule:

How To Copy Files From Azure Blob Storage To AWS S3

 

automate sftp transfer - 5

 

Since, in a production environment, there will presumably be several file movements and we want this trigger to respond only to a specific file movement, we need to specify a set of trigger conditions. 

I'm going to build a trigger condition that will allow this trigger to respond only to those File Move events wherein:

  • The Source File is 'E:\downloads\azureblobdownloadfile.txt', and
  • The Destination File is 'D:\testuserfiles\azureblobdownloadfile.txt'

Recommended read: Introducing the New Trigger Conditions Expression Builder

Click Next once you're done building the trigger condition.

 

automate sftp transfer - 6

 

In the next screen, click the Add button and then select 'SFTP File Upload' from the action drop-down list.

 

automate sftp transfer - 7

 

In the action parameters dialog, start by specifying the hostname or IP address of the remote SFTP server where you want to upload the file in question.

 

automate sftp transfer - 8

 

Next, enter the login credentials of a valid user account on that remote SFTP server. 

After that, specify the file path of the file you wish to upload. Because we used the File Move event type in this trigger, we can use the %DestinationFile% variable for this purpose. This variable already holds the complete file path of the file after it was moved to the local destination directory. 

Lastly, specify the target directory in the remote SFTP server. I just want this file to be uploaded to the user account's root directory, so I'm just going to enter the forward slash (/) here.

 

automate sftp transfer - 9

 

Click OK and then drag an arrow from the Start output of the Workflow node to the Trading Partner Synchronization Action node. 

Recommended read: Introducing the Redesigned Trigger Action Workflow

Click OK to finalize the trigger creation process. 

 

automate sftp transfer - 10

 

automate sftp transfer - 11

 

That's it. Now you know how to configure JSCAPE MFT Server so that you can automate an SFTP transfer. 

Try this yourself

Would you like to try this yourself? Download the FREE, fully-functional Starter Edition of JSCAPE MFT Server now.

Download JSCAPE MFT Server

 

Related content

Guide on How to Set Up an SFTP Server

Preparing Trading Partner Servers For SFTP Automation

How to Monitor SFTP Directories & Download Files

Using A Remote SFTP Service As Network Storage For Your MFT Server

 

Topics: JSCAPE MFT Server, Managed File Transfer, Business Process Automation, Tutorials, Secure File Transfer, SFTP, Triggers