Move Files On Specific Word During File Upload Using Regular Expression

Posted by Hari Prasad on Nov 19, 2018 9:00:00 AM

This custom trigger function contains regular expression and file as parameters where the regular expression will be tested against the file. This function will help to identify validate specific constraint against the file before uploading/downloading. 

How to Move Files Using FileContains Function

Here in the example would like to take through on how to move files to a different folder on specific word in the file on file upload. Let me now show you how to implement that.

See How to Create Custom Trigger Functions for details on installation. In order to use this function, the build has to be downloaded. Checkout the downloads section for more details.


Source code and build instructions


1. Make sure you have FileContains function installed

Before creating a custom trigger to use the function FileContains, you need to have build installed in the server where JSCAPE MFT Server is running.


2. Create a trigger to use the function 

Now login into admin console of JSCAPE MFT Server > Triggers and Click Add to create a Trigger. Give the trigger a Name and then select the File Upload event type from the drop-down list. 




Click Next to Step 2 to set the condition, Click Functions button to select the function FileContains(filepath,regex).



If the function not listed you need to have build installed in the server. Use the below condition to check whether the word stop (irrespective of it's case) is in the file .





Click Next to proceed. On TRUE move the files.

On Step 3 an action has to be added, in order to add an action click Add button and select the action "Move File" from drop down list and Click OK




On OK there would be two parameters for Move File Action;

  - File (Uploaded File) - Use %LocalPath% to get the uploaded file

  - Destination Directory (Directory to be moved)



Click Ok to save the settings. That's it. Now you know how to use the custom function FileContains and move file on specific word using regular expression.


Download JSCAPE MFT Server

Topics: JSCAPE MFT Server, Functions