If you are familiar with JSCAPE MFT Server you may already be aware of the power and flexibility that Triggers can offer you as an administrator. If you are new to JSCAPE MFT Server, Triggers allow you to create automated events with the use of Event Type parameters and Trigger Actions. Basically, Event Types are predefined events with configurable parameters that represent a condition, when that condition is met it triggers the associated action to be performed. In this article I will show you how to create a Trigger to automate the deletion of aged files and explain how the Trigger accomplishes this task.
Automate File Deletion
We will be creating a Trigger for the specific scenario in which an administrator may want to automate the deletion of files over 30 days old. This could be useful for managing storage space, compliance or simply automating some basic housekeeping. With this Trigger we will use the "Current Time" Event type configured to run once a week. We will specify a particular directory we want this Trigger to look at. We will then use the "Delete Files" Action and configure a Regular Expression within it to look for MS Word documents and PDF files older than 30 days old and delete them.
First, let's create a new Trigger by clicking on the "Triggers" node under the Domain and click "Add". We will give our new Trigger an appropriate name, select "Current Time" from the Event Type drop down and give it a description. Then Click "Next".
Now we will specify when we want our Trigger to run. In this example I am configuring this Trigger to run every Sunday night just before midnight. The expression we are using to do this is:
DayOfWeek = 1 AND Hour = 23 AND Minute = 59
We are specifying the day of the week as "1" which means Sunday. The hour and minute is 11:59pm. We can then click the "Test Expression" button and verify our expression will work. Now click "Next".
Now we are going to add our Trigger Action so click "Add". In this example I will be using this Trigger on the dropzone directory for my server domain. I will be using this regular expression to have this action look for ".doc" and ".pdf" files:
For more information on using regular expressions in JSCAPE MFT Server Click Here.
We will then set the "Delete Files Older Than (days)" parameter to 30.
You can also select the option to "Delete Empty Directories" which you may or may not want to do.
You can continue to add more file types into the Regular Expression if there are more file types you want this Action to look for following the same format you see here. You could also create another Action here to look in more directories. Now you can click "OK" and you should see your Action on the list.
Click "OK" once more and your Trigger is now created. Lastly, click "Apply" to enable your Trigger.
Now you have a Trigger created to automatically delete files older than 30 days old in the directory of your choosing on every Sunday at 11:59pm. Feel free to check out some additional articles on Triggers and Regular Expressions that you may find useful.