From installation to task scheduler - step by step instruction

This will walk through you from installing to running on the schedule MSH Delete Files Older Than application.

Files for testing

Instruction will demonstrate removing files prepared for this scenario, so please create a test directory on C partition.

Put test name while creating new directory.

Next create a sample.txt file in C:\test directory.

Installation

Download the application from MSH Tools website. Next go to download directory and run Setup.MSHSoftware.DeleteFilesOlderThan.exe file.

Select I agree to the license terms and conditions option, click Install button.

Click Yes button to agree to install the application (if User Account Control window will show up).

Wait till application successfully install and click Launch button.

Licensing

If you don’t have a license key yet skip this step. Application can work in demo mode but will remove only 10 first matched files and will not delete any files from Command Line.

Click Application works in DEMO mode link.

Click Enter license key button.

Click Browse button.

Select license.key file (you should receive it from MSH Software). Click Open button.

Application will inform that restart is required.

At next application run you will see that application is licensed to your registration name.

Create a test Rule

Select Default Startup Sample Rule and click Remove button.

Click Yes button.

To create a new rule click Add button.

On Folders tab click Add button to select folder.

Put C:\test value in Folders Path then click OK button.

Switch to Time tab and change Match files which are older than 30 from days to seconds.

Seconds are used only for our test scenario, for your files you should use better option.

Switch to Files tab and select Only specified filenames option then click Add button.

Select Wildcards option and put *.txt value in Filename Pattern then click OK button.

Switch to Action tab and select Move files to Recycle Bin.

Switch to Name tab and put Test Rule in Rule Name field, select Enable Rule option then click OK button

Run the Rule from GUI

Select Test Rule and click Run button.

After finishing the rule in Jobs section new entry will be created.

It’s a report from finished job, select finished job entry and click Show Report button.

There will be entry about sample.txt file which was Moved to Recycle Bin.

Run the Rule from Command Line

To run rules from Command Line application need to be licensed, because in demo mode none files will be removed.

Before we begin go to Recycle Bin and restore previously removed sample.txt file.

Export Rules

Before we could run application from Command Line rules need to be exported to external settings.xml file. Click Options button and then click Export Rules menu.

Go to C:\test directory and click Save button.

Click OK button.

Close the application and run the Command Line. Click Right or Left Mouse Button on the Menu Start and select Run menu. Also shortcut Win+R will work.

Put cmd value in Open field and click OK button.

To run application with previously exported rules put command and press Enter.

"c:\Program Files (x86)\MSH Delete Files Older Than\MSHSoftware.DeleteFilesOlderThan.exe" -f c:\test\settings.xml -o c:\test

-o c:\test parameter will tell the application to create CSV job report (it could be later used to check what was removed) Application should run without any output from Command Line. Go to C:\test directory and you will see that there was created Test Rule-xxxx-xxxx.csv file.

You could edit this file ie. with Notepad to see what was done with sample.txt file.

Run the Rule from Task Scheduler

If you already invoke application from Command Line go to Recycle Bin and restore sample.txt file.

Run Task Scheduler by Windows Search or taskschd.cmd from Command Line.

Click Action menu and select Create Basic Task menu.

Put Remove sample.txt from test directory value in Name field, click Next button.

Select when to start removing files, for our example select On time option, click Next button.

Choose date and time 5 minutes forward, click Next button.

Select Start a program option and click Next button.

Put

"C:\Program Files (x86)\MSH Delete Files Older Than\MSHSoftware.DeleteFilesOlderThan.exe"

value in Program/script field or choose it by clicking Browse button. Put

-f c:\test\settings.xml -o c:\test 

value in Add arguments field. Click Next button.

Click Finish button on final screen.

Wait till task should start and go to C:\test directory to check if there are two CSV files, which means that Task Scheduler did run application rules.

To learn more visit MSH Delete Files Older Than website.

Lukasz is a software developer and owner of MSH Software company which builds email processing tools for Microsoft Exchange, Zimbra Collaboration Suite and Postfix. He specializes in server, desktop and web applications written in Java, .NET and C++.