Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 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 (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-02T17:48:12.000Z (almost 9 years ago)
- Last Synced: 2024-05-13T16:24:36.758Z (9 months ago)
- Topics: cleanup, csharp, directory, dot-net, folder, nuget, temporary
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 5
- Watchers: 3
- 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