diff --git a/Frends.Files.Delete/Frends.Files.Delete/Delete.cs b/Frends.Files.Delete/Frends.Files.Delete/Delete.cs index 8db1119..a487b61 100644 --- a/Frends.Files.Delete/Frends.Files.Delete/Delete.cs +++ b/Frends.Files.Delete/Frends.Files.Delete/Delete.cs @@ -130,7 +130,15 @@ internal static PatternMatchingResult FindMatchingFiles(string directoryPath, st throw new DirectoryNotFoundException($"Directory does not exist or you do not have read access. Tried to access directory '{directoryPath}'"); var matcher = new Matcher(); - matcher.AddInclude(pattern); + + var patterns = pattern.Split('|', StringSplitOptions.RemoveEmptyEntries); + + // Add each pattern separately to the matcher + foreach (var individualPattern in patterns) + { + matcher.AddInclude(individualPattern.Trim()); + } + var results = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath))); return results; } @@ -139,4 +147,4 @@ private static void OnPluginUnloadingRequested(AssemblyLoadContext obj) { obj.Unloading -= OnPluginUnloadingRequested; } -} \ No newline at end of file +}