Rename a file using AppendDateOrTimeToFileName Function

Posted by Hari Prasad on Jul 18, 2018 2:42:16 PM

This custom trigger function is used to rename a file by adding system date or system time or combination of both.

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


Source code and build instructions

How to Rename a File using AppendDateOrTimeFileName Function

 Let me now show you how to implement that.


1. Make sure you have AppendDateOrTimeFileName function installed

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


2. Create a Trigger to Rename a File

Before creating a trigger first you need to sure on what would be the Date Format needed to rename a  file name. 

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 where a condition can be set to execute the trigger. No condition is required in this example, Click Next to proceed to proceed to step 3.

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




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

  - File (Uploaded File) 

  - Destination File (Renamed File)


In the File filed give the value as  %LocalPath% , On the Destination File field Click Functions button to select the AppendDateOrTimeFileName(file,datePattern) function.

If the function not listed you need to have build installed in the server.




On select make the Destination File field to be as below;




The above returns a filename with hour,minute and seconds amended. Consider an example that you have file name test.txt uploaded, upon upload the file will be renamed to text_20_23_01.txt when the file is uploaded to the server at 8:23:01 PM

Click Ok to save the settings. That's it. Now you know how to use the custom ffunction AppendDateOrTimeFileName to rename a file.



Download JSCAPE MFT Server

Topics: JSCAPE MFT Server, Functions