A couple of weeks ago, I received another interesting query from one of our customers. He was setting up an automated FTP download with one of his trading partners and wanted to know how he could move those files that have just been downloaded from the remote server to an archive directory on that same server . I was thinking many of you would find it useful, so I decided to share the steps I recommended then.
In order to follow this particular tutorial, you would need the following elements on your JSCAPE MFT Server:
Done reading those two posts? Let's proceed.
Create a new trigger, give the new trigger a name (e.g. "Move Remote Files After FTP Download"), and then select the External File Download event type.
The External File Download event is thrown each time a file is downloaded as a result of a recently fired (download) trigger action. Examples of such trigger actions are the Trading Partner File Download and Trading Partner Regex File Download trigger actions. We talked about these two trigger actions in the article How To Set Up A Scheduled Automatic Download With A Trading Partner.
Click Next to proceed.
The next step of this automated FTP download tutorial would be to create a trigger condition that would narrow your trigger down to a specific download or specific set of downloads.
If your managed file transfer server is running in a production environment, chances are, you'll have several downloads going on at any given time. In order to make sure the trigger we're creating here only acts on a specific set of downloads, we need to put together a set of trigger conditions that would filter out all unrelated downloads.
For example, we can tell JSCAPE MFT Server to act only on those downloads that take place after 8 PM on the first day of each month. I chose this time because it jives with the schedule of the automatic download we discussed in How To Set Up A Scheduled Automatic Download... .
You can refine your filter even further by making use of other variables such as the:
Once you're done, click on the Next button.
Now it's time to set up the trigger action that would move the freshly downloaded file(s) to another folder on the remote server.
The trigger action we'll need for moving the file(s) on the trading partner's remote server is the Trading Partner Rename File. Expand the Action drop-down list box and select that trigger action we just mentioned. Click OK when done.
When the parameters dialog appears, the first setting you'll see is the Partner drop-down list box. Expand that list and select the trading partner you have downloaded files from.
Next, specify the Remote Directory that contains the source files you just downloaded (e.g. /fordownload).
After that, enter the %Name% variable into the Source File field. This variable contains the local filename of the file that was most recently downloaded, which, unless you changed it during download, will be the same as the filename in the remote server.
Lastly, specify the Destination File. This value should consist of the destination directory (on the remote server) and the filename the file should take after it's been moved. If you specify a name, then you would have "renamed" the file. Hence the name "Trading Partner Rename File". In our case, we only want to move the file, not rename it, so we just use the %Name% again.
Click the OK button when you're done.
Here's a summary of what takes place in this automated FTP download:
This concludes our tutorial. We hope to see you again next time.
Want to try this out yourself? Get started with JSCAPE when you request your exclusive free trial experience.