Files

Frends.Files.Delete / 2.0.0

Summary

Deletes the files in a directory that match a pattern, and reports which ones went.

Typical use — clearing a spool or working directory once its contents have been handed on

Remarks

Pattern matching

Delete Task uses pattern matching for deleting files.

The search starts from the root directory defined in the input parameters.

* to match one or more characters in a path segment

** to match any number of path segments, including none

Examples:

**\output\*\temp\*.txt matches:

  • test\subfolder\output\2015\temp\file.txt
  • production\output\2016\temp\example.txt

**\temp* matches

  • prod\test\temp123.xml
  • test\temp234.xml

subfolder\**\temp\*.xml matches

  • subfolder\temp\test.xml
  • subfolder\foo\bar\is\here\temp\test.xml

Details

Frends version
5.7 and newer
Agent
Crossplatform
Target framework
net8.0
2.0.02026-09-10
Changed
  • Upgraded the task to .NET 8.
  • Breaking Standardize pattern matching logic between tasks.
  • Clarified relative input matching rules: patterns are evaluated relative to Directory, separators are normalized to /, matching is case-insensitive, glob mode supports * and **, and <regex> enables regex evaluation against the relative path and file name.
1.2.02025-03-19
Changed
  • Update packages: Microsoft.Extensions.FileSystemGlobbing 7.0.0 -> 9.0.3 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 System.DirectoryServices 7.0.0 -> 8.0.0 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.6.1 -> 17.13.0 MSTest.TestAdapter 2.2.7 -> 3.8.3 MSTest.TestFramework 2.2.8 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0
1.1.02025-03-13
Fixed
  • Fixed bug where regex patterns were not handled correctly in file matching.
1.0.02023-02-13
Added
  • Initial implementation
An unhandled error has occurred. Reload 🗙