Extract Files task
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018
Use this task to extract files from archives to a target folder using match patterns. A range of standard archive formats is supported, including .zip, .jar, .war, .ear, .tar, .7z, and more.
# Extract files # Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip - task: ExtractFiles@1 inputs: #archiveFilePatterns: '**/*.zip' destinationFolder: #cleanDestinationFolder: true #overwriteExistingFiles: false #pathToSevenZipTool:
|Archive file patterns||
Patterns to match the archives you want to extract. By default, patterns start in the root folder of the repo (same as if you had specified
Specify pattern filters, one per line, that match the archives to extract. For example:
The pattern is used to match only archive file paths, not folder paths, and not archive contents to be extracted. So you should specify patterns such as
|Destination folder||Folder where the archives will be extracted. The default file path is relative to the root folder of the repo (same as if you had specified
|Clean destination folder before extracting||
Select this check box to delete all existing files in the destination folder before beginning to extract archives.
Default value: true
|Overwrite files in the destination directory||
Select this option to overwrite files in the output directory if they already exist. If the option is
Default value: false
|Path to 7z utility||(Optional) You can specify custom path to 7z utility using this option. If it's not specified on Windows - default 7zip version supplied with a task will be used.|
Extract all .zip files recursively
This example will extract all .zip files recursively, including both root files and files from sub-folders
steps: - task: ExtractFiles@1 inputs: archiveFilePatterns: '**/*.zip' cleanDestinationFolder: true overwriteExistingFiles: false
Extract all .zip files from subfolder
This example will extract
test/two.zip but will leave
steps: - task: ExtractFiles@1 inputs: archiveFilePatterns: 'test/*.zip' cleanDestinationFolder: true overwriteExistingFiles: false
This task is open source on GitHub. Feedback and contributions are welcome.
Where can I learn more about file matching patterns?
Q: I'm having issues with publishing my artifacts. How can I view the detailed logs?
To enable detailed logs for your pipeline:
- Edit your pipeline and select Variables
- Add a new variable with the name
Q: Which variables are available to me?
$(Agent.BuildDirectory) are just few of the variables you can use in your pipeline. Variables are available as expressions or scripts.
Q: Task allows me to publish artifacts in deployment job in yaml pipeline, but I am not able to use it in downstream pipeline?
A: Deployment jobs do not have the context of source branches and are hence not appropriate for publishing artifacts. They have been primarily designed to consume artifacts. A workaround would be to isolate that logic into a separate job (with dependencies on your deployment jobs).
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.
My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?
This can be fixed by adding a trusted root certificate. You can either add the
NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the
NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.
Submit and view feedback for