https://github.com/tallesl/net-fresh
Periodically cleans up a folder.
https://github.com/tallesl/net-fresh
cleanup csharp directory dot-net folder nuget temporary
Last synced: 8 months ago
JSON representation
Periodically cleans up a folder.
- Host: GitHub
- URL: https://github.com/tallesl/net-fresh
- Owner: tallesl
- Created: 2015-03-09T18:29:48.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T17:48:12.000Z (about 10 years ago)
- Last Synced: 2025-10-10T07:32:27.703Z (8 months ago)
- Topics: cleanup, csharp, directory, dot-net, folder, nuget, temporary
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fresh
[![][build-img]][build]
[![][nuget-img]][nuget]
A .NET library that periodically cleans up a folder.
Useful for cleaning up temporary files.
[build]: https://ci.appveyor.com/project/TallesL/net-fresh
[build-img]: https://ci.appveyor.com/api/projects/status/github/tallesl/net-fresh?svg=true
[nuget]: https://www.nuget.org/packages/Fresh
[nuget-img]: https://badge.fury.io/nu/Fresh.svg
## Usage
```cs
using FreshLibrary;
var cleaner = new FreshFolder("Temp", TimeSpan.FromMinutes(30), TimeSpan.FromHours(2), FileTimestamps.Creation);
```
This creates and starts a cleaner that, every `2` hours, deletes all files in `Temp` folder that have been `created`
over `30` minutes ago.
The cleaner already starts its cleaning after its construction.
Remember to `Dispose()` it when you're done.
Consider disposing the cleaner on `Application_End` or [`ProcessExit`].
[`ProcessExit`]: https://msdn.microsoft.com/library/System.AppDomain.ProcessExit