This tutorial shows how to automatically delete files in Windows using Automation Workshop application.
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.
How to automatically delete files older than 30 days? 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.
How to create a new Task in Automation Workshop? 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).
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.
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.
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.
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.
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
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 Filter tab and enable the option 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 interactive Visual guide). 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 manager.
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.
If you have any questions, please do not hesitate to contact our support team.