With the .Net Core 2.1 version, we could use worker services. With the release of .Net Core 3.0, you can create it as a separate project via CLI or Visual Studio. Worker Service is a cross-platform background service. We can think of it just like the Windows Services we have created.
With this worker service, you will be able to sort your files in a certain location according to the last access date.
After cloning this repository and installing Visual Studio enter the project's folder through the command line and type the following code to run the program:
dotnet run
You must change the sections specified in the appsettings.json file.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
//Type the path to the file you want to list
"PathOfDirectory": "C:/Users/",
//Write the date you want to sort in days
"OlderThanDays": "90",
//Specify the path to the file you want to save
"FileSavePath": "\\..\\..\\..\\..\\Files.txt"
}