Everyday, files are uploaded to a certain folder on your file transfer server. And everyday, you're supposed to gather those files into a zip file and forward it to a trading partner. Here's how you can automate that process on JSCAPE MFT Server.
What we're trying to do
One way to do this is by creating a trigger that fires everyday, on a pre-defined schedule.
1. Creat a trigger that fires on a pre-defined schedule
Create a trigger and give it a name (e.g. "Zip Upload and Move"). Select the Current Time event type.
We already wrote a tutorial dedicated to the subject of creating a scheduled file transfer, so let me just link to that:
After filling up the trigger condition box with your desired schedule, the next step would be to add some trigger actions that would let this trigger zip the files you need to upload, upload the zip file to your trading partner's server, and move the zip file into a separate folder for archiving purposes.
2. Add a trigger action for zipping the files
Let's now add our first trigger action. This trigger action will look inside the folder where the files you want to upload are stored and then compress them into a zip file. To add a trigger action, just click the Add button.
Select "Zip Regex File" from the drop-down list and then click OK.
Specify the parameters for the Zip Regex File trigger action. The basic parameters include the following:
Directory - This is the directory where the files you want to zip are stored
Destination - This is the destination zip file that will hold your zipped files. This file doesn't have to be currently existing. JSCAPE MFT Server will create it for you.
Regular expression - This is where you'll enter the regular expression for selecting the files you want zip. To learn more about regular expressions, read the post "Using Regular Expressions in Triggers".
Delete source - Notice that we checked the Delete Source check box. Do this if you want to delete the original files as soon as the zip process completes.
Click OK to proceed
The next step is to add a trigger action that would upload the newly generated zip file to your trading partner. This will require the presence of a Trading Partner entity. If don't know what a Trading Partner entity is, the post "Preparing Trading Partner Servers For SFTP Automation" offers a nice introduction on the subject.
3. Add a trigger action for uploading the zip file to a trading partner
Click the Add button again to add another trigger action. This time, select "Trading Partner Regex File Upload". You can also select Trading Partner File Upload if you want. Click OK to proceed.
Specify the parameters for this trigger action. The essential parameters include the following:
Partner - This is the trading partner entity. You simply select it from a drop-down list box.
Local Directory - If you recall from the previous section, we stored our zipped files into a destination file. That destination file was naturally stored in a certain directory. (For the purpose of this tutorial) That's the directory you need to enter here.
Regular expression - This regular expression is supposed to select the zip file, whatever its name is.
Remote Directory - Here, in our example, we simply enter the forward slash (/). That will place our zip file in the home directory of what ever user account (on the remote server) was used for this particular trading partner.
Click OK to proceed.
Lastly, we need to add a trigger action that would move the original copy of the uploaded zip file into a separate folder (perhaps for archiving purposes).
4. Add a trigger action for moving the original copy of the zip file
Add the "Move Regex File" trigger action. You may also use the Move File trigger action.
Specify that trigger action's parameters:
After clicking OK, you should then see all three trigger actions arranged in the following order:
That's it. If you want to follow this tutorial, download a free, fully-functional evaluation edition of JSCAPE MFT Server now.