27 lines
790 B
C#
27 lines
790 B
C#
using File_Watcher.Models;
|
|
|
|
namespace File_Watcher.Helpers;
|
|
|
|
internal static partial class HelperEAFLog
|
|
{
|
|
|
|
internal static bool DeleteFiles(AppSettings appSettings, ILogger<Worker> logger)
|
|
{
|
|
IEnumerable<string> files = Directory.EnumerateFiles(appSettings.WatchDirectory, appSettings.EAFLogConfiguration.SearchPattern, SearchOption.AllDirectories);
|
|
foreach (string file in files)
|
|
{
|
|
if (file.EndsWith(".dll"))
|
|
continue;
|
|
if (file.EndsWith(".pdb"))
|
|
continue;
|
|
if (file.EndsWith(".xml"))
|
|
continue;
|
|
try
|
|
{ File.Delete(file); }
|
|
catch (Exception ex)
|
|
{ logger.LogError(ex, "Inner loop error!"); }
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} |