As soon as an automated server to server download completes, you might want to generate a list of those files that have been successfully downloaded. This tutorial will show you how to do that.
What we're trying to do
Let me give you a specific sample scenario so you can better appreciate what we're trying to do here.
Let's say you've set up a scheduled automatic download with a trading partner. The download is set to commence at say 8:30 PM of every first day of the month.
Now, because this is an automated file transfer, you wouldn't have to be there when the download happens. However, you certainly would want to check at a later time (perhaps the following day) whether all the files you expected to be downloaded actually made it into the local folder they were supposed to be stored in.
This is where the automatically generated list can come in handy. You can simply retrieve that list and go through it to see if all the files went through. Better yet (because you can really just search in the destination folder to verify), you can configure the server to send you an email notification with the list attached to it as reference. We'll teach you how to set up that email notification thing in the next post, so stay tuned for that.
Let's now go through the steps that will enable JSCAPE MFT Server to generate that list.
1. Add the "Append File" Trigger Action
For this example, we're going to generate our list unto a (.txt) text file and save it into a folder for future viewing. What we'll need for this purpose is the Append File trigger action. The Append File trigger action simply allows the server to add contents to a file. The contents can be strings of text and/or the values of a variable or variables. In our case, we'd like to fill it with the values of the %LocalPath% variable. This variable contains the complete local path of the file that was downloaded.
Because we want to generate our list right after a download, we'll want to add that trigger action to a trigger that uses the External File Download trigger event.
One of our recently published articles already discussed that particular trigger event, so let's just use that article for reference. Bring up the article Moving Files On The Remote Server After An Automated FTP Download and read the succeeding steps found there. That will give you an idea how that trigger event is normally used.
After you've created a trigger that uses the External File Download trigger event and specified a trigger condition (or simply left that part blank), you can then add the Append File trigger action.
2. Specify the Append File action parameters
This trigger action mainly consists of two basic parameters:
- The File, which is the file where each entry will be appended to, and
- The Messsage, which is where you put the strings of text and/or value(s) of whichever variables you want to use.
Here, we just use the %LocalPath% variable.
Note that each file download corresponds to one External File Download event and that each External File Download event will cause the trigger that uses that event to fire. So if one download session consists of 10 files, then that will also correspond to 10 External File Download events. Consequently, any trigger that uses the External File Download trigger event will likewise be called 10 times.
Therefore, each time that trigger is run, the value of the %LocalPath% variable may change and the entry that the Append File action appends to File will also change. And that's how the list will be generated.
3. Finalize the trigger
Finalize the trigger until you're back to the main screen. In the list of trigger actions shown below, you can see that our Append File trigger action is one of two trigger actions that will be fired when the trigger executes. So, if this trigger action were added to the "Move Remote Files After FTP Download" trigger (see Moving Files On The Remote Server After An Automated FTP Download) as shown below, then it would be fired after the Trading Partner Rename File trigger action.
Here's an example of what you'll see on the list that would be generated.
In our next post, I'll show you how to send that list in an email. See you then.
Would you like to connect with us on social media? We'd certainly love that ...