Redaguoti

Bendrinti naudojant


ExtractFiles@1 - Extract files v1 task

Use this task to extract a variety of archive and compression files, such as .7z, .rar, .tar.gz, and .zip.

Syntax

# Extract files v1
# Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip.
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '**/*.zip' # string. Required. Archive file patterns. Default: **/*.zip.
    destinationFolder: # string. Required. Destination folder. 
    #cleanDestinationFolder: true # boolean. Clean destination folder before extracting. Default: true.
    #overwriteExistingFiles: false # boolean. Overwrite existing files. Default: false.
    #pathToSevenZipTool: # string. Path to 7z utility.
# Extract files v1
# Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip.
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '**/*.zip' # string. Required. Archive file patterns. Default: **/*.zip.
    destinationFolder: # string. Required. Destination folder. 
    #cleanDestinationFolder: true # boolean. Clean destination folder before extracting. Default: true.
    #overwriteExistingFiles: false # boolean. Overwrite existing files. Default: false.
# Extract files v1
# Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip.
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '*.zip' # string. Required. Archive file patterns. Default: *.zip.
    destinationFolder: # string. Required. Destination folder. 
    #cleanDestinationFolder: true # boolean. Clean destination folder before extracting. Default: true.
# Extract Files v1
# Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip.
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '*.zip' # string. Required. Archive file patterns. Default: *.zip.
    destinationFolder: # string. Required. Destination folder. 
    #cleanDestinationFolder: true # boolean. Clean destination folder before extracting. Default: true.

Inputs

archiveFilePatterns - Archive file patterns
string. Required. Default value: **/*.zip.

Specifies the file paths or patterns of the archive files to extract. Supports multiple lines of minimatch patterns. Learn more about the Extract Files task.

Specifies the 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 $(Build.SourcesDirectory).
Specifies the pattern filters, one per line, that match the archives to extract. For example:

  • test.zip extracts the test.zip file in the root folder.
  • test/*.zip extracts all .zip files in the test folder.
  • **/*.tar extracts all .tar files in the root folder and sub-folders.
  • **/bin/*.7z extracts all .7z files in any sub-folder named "bin".
    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 **/bin/** instead of **/bin.

archiveFilePatterns - Archive file patterns
string. Required. Default value: *.zip.

Specifies the file paths or patterns of the archive files to extract. Supports multiple lines of minimatch patterns. Learn more about the Extract Files task.


destinationFolder - Destination folder
string. Required.

Specifies the destination folder into which archive files should be extracted. Use variables if files are not in the repo. For example: $(agent.builddirectory).


cleanDestinationFolder - Clean destination folder before extracting
boolean. Default value: true.

Specifies the option to delete the entire content of the destination directory (clean) before archive contents are extracted into it.


overwriteExistingFiles - Overwrite existing files
boolean. Default value: false.

Specifies the option to overwrite existing files in the destination directory if they already exist. If the option is false, the script prompts on existing files, asking whether you want to overwrite them.


pathToSevenZipTool - Path to 7z utility
string.

Specifies the custom path to 7z utility. For example, C:\7z\7z.exe on Windows and /usr/local/bin/7z on MacOS/Ubuntu. If it's not specified on Windows, the default 7zip version supplied with a task will be used.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

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.

For more information about file matching patterns, see the File matching patterns reference.

Examples

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/one.zip and test/two.zip, but will leave test/nested/three.zip.

steps:
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: 'test/*.zip'
    cleanDestinationFolder: true
    overwriteExistingFiles: false

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: Setting variables is disabled
Agent version 2.182.1 or greater
Task category Utility
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Utility

See also