🧡 Skip to main content🔍 Skip to search
Matthew AdamsBy Matthew Adams 🕐 Updated on January 3, 2024 at 1:00 pm
YouTube video · Delete old log files

Delete the old files using Automation Workshop for Windows. Creating an automated task is quick and easy. No programming knowledge required. Follow steps from the tutorial, or simply download a demo task.

Get the Demo Task…

Overview

Let's suppose the following scenario. New document files are routinely put into C:\Documents\ folder. On the other hand, the documents that have not been modified within last 30 days are not anymore necessary. We would like to automatically delete old files on daily basis.

Creating a Task that will automatically delete old files on daily basis involves just a few simple steps. Namely, creating a new Task in Automation Workshop, adding the Task Scheduler trigger for automatic daily execution, adding the Delete File action and setting up its date range filter.

Create a Task

How to create a new Task? Open Automation Workshop Manager and either click on the New Task button on toolbar or select the New Task option in the File menu. Alternatively, keyboard shortcut CTRL+N can be used. This will bring up the Welcome screen of Task Wizard. Proceed to the next tab to add the Task Scheduler Trigger (which will automatically launch the Task on daily basis).

Task Scheduler

How to add and configure the Task Scheduler Trigger? Once in the Triggers tab of Task Wizard, click the Add button to choose the necessary trigger from the Add Trigger window. In order to automatically remove files on daily basis, the Task Scheduler trigger has to be chosen.

Add Trigger: Task Scheduler
Add a Task Scheduler

Task Scheduler automatically launches the Task with specified regularity or according to more complex schedules. What we need for our purpose is the most basic schedule of Task execution, namely, the Task should be executed daily and recur every 1 day. Let us set up the execution time at 6:00 PM.

Task Scheduler: daily
Daily scheduler

Click OK and see that the Task Scheduler Trigger has been added to the Triggers list. Click Next to proceed to Actions tab to add the Delete File Action which will automatically delete old files whenever performed.

Delete old files

How to add and configure an Action to automatically delete files older than 30 days? First, click the Add button to open a Add Action window with list of available Actions. Find and open the Delete File Action in the File & Folder category.

Add Action: Delete File
Add a Delete File

The File tab of the Delete File Action properties requires to specify the path and names (or masks) of files to be deleted. Since the goal is to automatically delete all files older than 30 days, an appropriate mask should be used (*.* mask means files with any name and any extension, or, simply, all files).

Click on the Browse button and choose any file in the C:\Documents\ folder, then substitute the actual file name with *.* so that the File input line contains the C:\Documents\*.* expression (this will match all files).

Delete file: C:\Documents\*.*
Delete C:\Documents\*.*

So far the Action is told to delete all files in the C:\Documents\ folder. However, only the files older than 30 days should be deleted. In order to configure Automation Workshop to automatically remove files older than 30 days (and not all the files), go to Exclude tab and enable the option Do not delete files that are modified in last 30 days.

Delete File filter: Do not delete files that are modified in last 30 days

Thus, Automation Workshop will automatically delete files that have not changed during last 30 days, while leaving newer files untouched (view Advanced date filter). Click OK to save the Delete File Action parameters and return to Task Wizard.

Congratulations!

The configuration of relevant Trigger and Action has been completed. Just finish the remaining Task Wizard procedures, such as providing Run As settings and configuring email reports.

Give the Task a recognizable name (e.g., remove 30 day old files) and brief description. Click Next, then Finish and notice the new Task in Automation Workshop Task Pane.

As configured, the Task will be executed by the Task Scheduler trigger once a day at 6 PM and perform the Delete File action that, in turn, will delete files in the C:\Documents\ folder that have not been modified for at least 30 days.

We are here to help…

If you have any questions, please do not hesitate to contact our support team.