Published in:

Blog

·

·

Rename a file using AppendDateOrTimeToFileName function

·

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

SeeHow to Create Custom Trigger Functionsfor 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 havebuildinstalled 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 ClickAddto create a Trigger

Give the trigger aNameand then select theFile Uploadevent 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 conditionis required in this example,ClickNextto proceed to proceed to step 3.

On Step 3 an action has to be added, in order to add an action clickAddbutton 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 fieldClick Functions button to select theAppendDateOrTimeFileName(file,datePattern)function.

If the function not listed you need to havebuildinstalled 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

ClickOkto save the settings.That’s it. Now you know how to use the custom ffunctionAppendDateOrTimeFileName to rename a file.

Downloads

Download JSCAPE MFT Server

Latest Articles