C# Utility to Delete Periodically Aged Files [closed]
-
21-09-2019 - |
Question
Any recommendation on a C# utility (open source) that can can cleanup/delete aged files. Ideally runs as a service.
Solution
Here's a Powershell script that I run as a scheduled task:
dir c:\directory-to-watch | where {$_.LastWriteTime -lt
[DateTime]::Today.AddDays(-7)} | del
Delete all files not touched in the last seven days from c:\directory-to-watch.
OTHER TIPS
We use xxcopy scripts that we create and that are executed from task scheduler as Forgotten Semicolon mentions above.
Checkout their command line reference. Their utility is extremely useful and flexible.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow