Delete Files task
Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015.3
Use this task in a build or release pipeline to delete files or folders from the agent working directory.
# Delete files # Delete folders, or files matching a pattern - task: DeleteFiles@1 inputs: #SourceFolder: # Optional #Contents: 'myFileShare' #RemoveSourceFolder: # Optional
Folder that contains the files you want to delete. If you leave it empty, the deletions are done from the root folder of the repo (same as if you had specified
If your build produces artifacts outside of the sources directory, specify
Specify minimatch pattern filters (one on each line) that you want to apply to the list of files to be deleted. For example:
This task is open source on GitHub. Feedback and contributions are welcome.
Q & A
Q: What's a minimatch pattern? How does it work?
Q: I'm having problems. How can I troubleshoot them?
A: Try this:
On the variables tab, add
system.debugand set it to
true. Select to allow at queue time.
In the explorer tab, view your completed build and click the build step to view its output.
The control options arguments described above can also be useful when you're trying to isolate a problem.
Q: How do variables work? What variables are available for me to use in the arguments?
$(Agent.BuildDirectory) are just a few of the variables you can use.
Variables are available in expressions as well as scripts; see variables to learn more about how to use them.
There are some predefined build and release variables you can also rely on.
Do I need an agent?
You need at least one agent to run your build or release.
I'm having problems. How can I troubleshoot them?
I can't select a default agent pool and I can't queue my build or release. How do I fix this?
See Agent pools.