azure-devopsbuild-processazure-pipelinesazure-pipelines-build-taskminimatch

VS TS Build exclude subdirectories in minmatch


I have a Delete Files task in VS TS Build, whose goal is to delete one file at the root of a Source Folder. The minimatch script I have does indeed delete the file correctly, but it also traverses all of the sub folders of the Source Folder directory also looking for a match, which wastes build time. I just want to delete this one file and stop the task.

Here is what I have (simplified for this example):

enter image description here

How can I accomplish this?


Solution

  • This is the expected behavior for Delete Files task. This task find all files and then match the patterns by default.

    As an alternative, you could use Powershell task to write a script to delete the file:

    Remove-Item –path c:\temp\MyFileName.txt