Azure-devops-docs: How to Archive multiple file and folder

Created on 4 Jul 2018  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

How to Archive multiple file and folder
My working directory is /Root
I want to archive folder "/Root/folder1" and files "/Root/file1.js", "/Root/file2.json" in one.zip file without create multiple task.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 devops-cictech devopprod product-feedback

Most helpful comment

So we have to create a separate zip step for each file we want to add not under a directory we want to add in its entirety and for each directory we do want to add in entirety. This is not better. Instead of X copy steps plus one zip step we just have X zip steps. Every compression tool takes a file list as a parameter for a reason. A file list option should be standard input from ADO.

Now I'm nitpicking with this next bit but, the wording for the inline help on "Replace existing archive" could be improved: "If enabled any existing archive file of the same filename will be deleted; otherwise the specified root folder or file to archive will be appended to the archive file." The current help also does not indicate an exception for compressed tar files.

All 6 comments

I am running into the same issue. I have two Archive Files tasks setup, and that works fine, but in the Extract Files task on the release it fails with what is described here: https://github.com/Microsoft/azure-pipelines-tasks/issues/7243

It throws this error: ERROR: Can't allocate required memory!

Which I understand to be because the Extract Files has two zips in the same location.

Getting this same error - ERROR: Can't allocate required memory! - for now just going to use powershell script with 7z node package.

image

PS/NPM Workaround

npm install -g 7zip 
$env:Path += ";$env:APPDATA\npm"
gci C:\myPath -recurse -Filter *.zip| % { 7z x -aoa -o"$([IO.Path]::Combine($_.DirectoryName, 'zip-content'))" $_.FullName }

The task just needs an option to add the 7zip -aoa CLI flag and we can drop this workaround.

This is an insanely common use case. Having to copy multiple directories into a subdirectory just to zip them up together is wasteful and overly complicated. Please fix this.

There is the option "Replace existing archive": If an existing archive exists, specify whether to overwrite it. Otherwise, files will be added to it as long as it is not a compressed tar.

So we have to create a separate zip step for each file we want to add not under a directory we want to add in its entirety and for each directory we do want to add in entirety. This is not better. Instead of X copy steps plus one zip step we just have X zip steps. Every compression tool takes a file list as a parameter for a reason. A file list option should be standard input from ADO.

Now I'm nitpicking with this next bit but, the wording for the inline help on "Replace existing archive" could be improved: "If enabled any existing archive file of the same filename will be deleted; otherwise the specified root folder or file to archive will be appended to the archive file." The current help also does not indicate an exception for compressed tar files.

@PoppyPham, it looks like you've encountered an issue with the product itself, rather than an issue with the documentation. We apologize that it's taken so long to address this issue. To make sure it gets in front of the right people, please submit your bug here.

Was this page helpful?
0 / 5 - 0 ratings