How to Create GetDirectorySize Trigger Function | JSCAPE

Posted by Hari Prasad on Sep 17, 2018 8:00:00 AM

This custom trigger function is used to get the directory size including its file contents.

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

Downloads

Source code and build instructions

How to Move File On Directory Threshold Using GetDirectorySize Function

 Let me now show you how to implement that.

 

1. Make sure you have GetDirectorySize function installed

Before creating a custom trigger with function GetDirectorySize, you need to

have build installed in the server where JSCAPE MFT Server is running.

 

2. Create a Trigger to Get the Size of the Directory 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. 

 

check_directory_size_img3

 

Click Next to Step 2 to set the condition to check the directory size on file upload.

Use the below condition;

Click Functions button to select the GetDirectorySize(directory) function.

 

check_directory_size_img2

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

Use the condition with below syntax,

 

GetDirectorySize(directory) <comapre-operators> n

 

Compare-operators can be >,<,>=,<=,= and n can be any value (MB)

 

Below screen shows an condition to check the a test directory. When the directory size is greater than 80 MB  files will be moved to another directory.

 

check_directory_size_img4-1

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)

 

check_directory_size_img5

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

Downloads

Download JSCAPE MFT Server

Topics: JSCAPE MFT Server, Functions