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.
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.
Let's create that trigger now. To create the trigger, just go to the Triggers module and click the Add button.
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
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.
In the next screen, click the Add button and then select 'SFTP File Upload' from the action drop-down list.
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.
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.
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.
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.
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