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 by comparing against a custom date along with timestamp.
See How to Create Custom Trigger Functions for details on installation.
How to move a file to a different folder using IsFileNewerByTimeStamp comparing it against a custom date and time
Let me now show you how to implement that.
1. Make sure you have IsFileNewerByTimeStamp function installed
Before creating a custom trigger with function IsFileNewerByTimeStamp, you need to have build installed in the server where JSCAPE MFT Server is running.
2. Create a Trigger to Compare a File Against a Custom Date 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.
Click Next to Step 2 to set the condition to check the file modification time using IsFileNewerByTimeStamp function
Use the below condition;
Click Functions button to select the IsFileNewerByTimeStamp(file,dd-MMM-yyyy HH:mm:ss) function. If the function not listed you need to have build installed in the server.
Use the condition with below syntax,
IsFileNewerByTimeStamp(file,"dd-MMM-yyyy HH:mm:ss") = TRUE
The above expression helps to check the uploaded file against a custom date and time. Consider an example, that we don't need files in the server older than a particular date and time. This function will help you in it by passing the date and time parameter along with the file that gets uploaded to the server. In this example this function will help to accept files after the said date and time moving them into a different folder.
This scenario can be reversed as well by accepting the files not after the custom date using "FALSE" condition. Example by using the condition as ; IsFileNewerByTimeStamp(file,"dd-MMM-yyyy HH:mm:ss") = FALSE
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)
If the file has to be overridden then the destination directory can be the location where the file actually exists.
Click Ok to save the settings. That's it. Now you know how to use the custom function IsFileNewerByTimeStamp and move file on threshold.