How to Move Downloaded Files on a Trading Partner | JSCAPE

If a trading partner wants you to move files you download from them to an archive, you can do so with our MFT Server. Learn more about moving files online!
  1. Blog

Let's say a trading partner wants you to move files you download from their server to a designated archive folder on that same server. This is a B2B file transfer, so it has to be automated. Here's what you can do to achieve that using JSCAPE MFT Server.

Watch the video

Would you prefer to watch a video version of this tutorial instead? You can play the video below. Otherwise, just skip it if you wish to continue reading.

Alright. So what I have here is a trigger that automatically downloads files from a trading partner's remote file transfer server.

edit sftp trading partner

It uses the Current Time event type such that...

current time sftp trading partner download

... it performs the download on a predefined schedule. Basically, it downloads files every Monday, at 8PM.

sftp trading partner download schedule

The trigger action I'm using here is the Trading Partner Regex File Download action, which would allow me to download multiple files in one go.

trading partner file download

As you can see, this trigger action downloads files from the remote directory named /downloadables and stores it in the local directory, 'C:\sftp-tp downloads'. Because I'm using the *.* wildcard, this means, this trigger action is going to download all the files found in the remote directory.

Again, this is the trigger that performs the download part. Our goal is to move each file downloaded by this trigger into a folder on the same remote host.

trading partner regex file download parameters

To do that, we're going to create a trigger that consists of:

1. The External File Download event type, and

2. a rename file action for remote hosts. There are several trigger actions that fit the bill, like the AFTP, FTP, FTPS, or SFTP Rename File trigger actions. But tor this example, we're going to use the Trading Partner Rename File action.

Let's proceed and add that trigger now.

add new trigger rename

The reason we're using the External File Download event type is because this event type enables a trigger to handle files downloaded by another trigger. In our case, the trigger we looked at earlier, 'sftp-tp'.

move files on sftp trading partner after download

You may add some trigger conditions to filter out other similar events but let's just leave this blank for now.

trigger conditions sftp download

But let's proceed and add the Trading Partner Rename File trigger action.

add new trigger action rename trading partner

trading partner rename file

In the trigger action's parameters dialog, we'll need to specify the following parameters:

  • Partner
  • Remote Directory
  • Source File
  • Destination File

All of these are important.

Let's talk about the Partner setting first. This represents the trading partner object this action will act on. It's important that you choose the partner you used in the previous trigger. So, in our case, that would be the 'sftp-tp' trading partner.

Next, we go to the Remote Directory field. The value you enter into this field should be the source remote directory of the file(s) you want to move for archiving. In our case, that would be the /downloadables directory, which, if you recall, is just the same directory where we downloaded files from in the previous trigger.

Next up is the Source File field. All you need to do here is enter the %Name% variable. This variable is one of the properties that accompany the External File Download event and it contains the filename of the file that was just downloaded.

Basically, if the previous trigger (which, if you recall, used the Trading Partner Regex File Download action) downloaded multiple files, each of those individual file downloads would raise an External File Download event and this trigger will respond to each of those events. So, if 10 files are downloaded, 10 instances of the External File Download event will be raised, and this trigger will subsequently respond 10 times.

Finally, we go to the Destination File field. This is simply the complete path of the renamed file. Notice that we're using a different directory here. Instead of the 'downloadables' directory, we're using the 'archive' directory. And then we're appending to that the %Name% variable. So, while the filename is not renamed, the complete path of that file is.

So, for example, if a file's original complete path is:


its new complete path, after being renamed, would be:


In effect, file001.txt is moved from the downloadables directory to the archive directory.

trading partner rename file parameters

changes successfully saved new trigger

That's it. Now you know how to automatically move files on a trading partner after downloading them using JSCAPE MFT Server

Try this yourself

Would you like to try this yourself? Request the FREE trial of JSCAPE MFT Server now.