Compare File Modification Time Using IsFileNewer

Posted by Hari Prasad on Oct 2, 2018 1:29:00 PM

This custom trigger function is used to get the status of the file on whether the file is really new against another or similar file using its modification time.

See How to Create Custom Trigger Functions for details on installation.

Downloads

Source code and build instructions

How to Move Modified File To a Different Folder Using IsFileNewer

 Let me now show you how to implement that.

 

1. Make sure you have IsFileNewer function installed

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

 

2. Create a Trigger to Compare the Modification Time on File Upload

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. 

 

is_file_newer_compare_file_img1

 

Click Next to Step 2 to set the condition to check the file modification time using IsFileNewer function

Use the below condition;

Click Functions button to select the IsFileNewer(file1,file2) function. If the function not listed you need to have build installed in the server.

Use the condition with below syntax,

 

IsFileNewer(File1,File2)

 

is_file_newer_compare_file_img2

The above expression helps to check the uploaded file against already existing file. Consider an example, that we have a bank master file uploaded to the system by a user everyday. The bank master file has to be overridden only if it is really modified else move to a backup folder. Here in this example if the file is really modified the modified file is moving to a different folder.

 

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)

If the file has to be overridden then the destination directory can be the location where the file actually exists.

 

check_directory_size_img5

Click Ok to save the settings. That's it. Now you know how to use the custom function IsFileNewer and move file on threshold.

Downloads

Download JSCAPE MFT Server

Topics: JSCAPE MFT Server, Functions