Files

Frends.Files.Delete / 1.2.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.5 and newer
Agent
Crossplatform
Target framework
net6.0

Input parameters.

Name Type Default Example Description
Directory String c:\temp

Source directory.

Pattern String "**\Folder\*.xml" test.txt, test*.txt, test?.txt, test.(txt|xml), test.[^t][^x][^t], <regex>^(?!prof).*_test.txt

Pattern to match for files. The file mask uses regular expressions, but for convenience, it has special handling for * and ? wildcards.

An unhandled error has occurred. Reload 🗙