Rename a file using AppendDateOrTimeToFileName Function

Updated by Hari Prasad on

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.

Downloads

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. 

 

append_file_name_with_date_img1

 

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

 

append_file_name_with_date_img2

 

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.

 

append_file_name_with_date_img3

 

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

%AppendDateOrTimeFileName(LocalPath,"_HH_mm_ss")%

 

append_file_name_with_date_img4

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.

 

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