In the interest of simply storing it, I would create a basic console application that performs the necessary cleanup. There will be no timer / scheduling code in this application.
I would set a window schedule to run it at the required times / intervals. Also (as Fredrick says in the comments), you can easily launch the console application manually if necessary.
I would not advise creating a Windows service if you do not need a task to start when no one is logged in, but then you also need to deal with starting under different privileges from an interactive user. In addition, a scheduled task can be executed when no one is logged in anyway (thanks Rob).
source share