Move Files Using Regex Expression By Maximum Number Of Lines In A File

Updated by Hari Prasad on

This custom trigger function contains regular expression, file and maximum number of lines as parameters where the regular expression will be tested up to the specified number of lines in the file. This function will help to validate specific constraint up to the maximum lines limit 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.

Downloads

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. 

 

file_contains_img_6

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

file_contains_img_7

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 .

 

FileContains(LocalPath,"^stop.*$",65540)=TRUE

 file_contains_img_8-1

 

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

 

move_file

 

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)

 

file_contains_img_5-2

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 up to maximum lines specified.

Downloads

Download JSCAPE MFT Server

Topics: JSCAPE MFT, Functions

Get A Free Trial

Download Your 7-Day Free Trial Version of JSCAPE MFT Server.

Get Your Free Trial