Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

CreateArchive

Create zip file from selected files and/or folders. Created zip file content can be flatten and file can be protected with password.

Task version: 2.0.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

SourceType : SourceFilesType

Source files input type.

Possible values:

  • PathAndFileMask: Files are searched from a directory with a file mask.

  • FileList: Files are given as a list of full paths.

Default: PathAndFileMask Example: PathAndFileMask

SourceDirectory : String

Source directory.

Default: - Example: C:\example\folder</code>

FileMask : String

The search string to match against the names of files.

This parameter can contain a combination of valid literal path and wildcard (* and ?) characters (see Remarks), but doesn't support regular expressions.

The default pattern is "", which returns all files.

Default: Example: *

IncludeSubFolders : Boolean

Indicates if subfolders and files should also be zipped.

Default: False Example: false

FlattenFolders : Boolean

Choose if source folder structure should be flatten when zipped.

Default: False Example: false

FilePathsList : List<String>

List of full file paths to include in zip.

Default: - Example: new List { Directory.GetFiles(_dir, "*.txt")[0] };

RemoveZippedFiles : Boolean

If true, files added to the zip are removed from source directory.

Default: False Example: false

DestinationDirectory : String

Destination directory.

Default: - Example: c:\temp

DestinationFileName : String

Filename of the zip to create.

Default: - Example: sample.zip

🗝Password : String

Add password protection to zip.

Default: - Example: foobar123

RenameDuplicateFiles : Boolean

True: If source files contains duplicate names, they are renamed (example.txt --> example_(1).txt).

False: Throws error if duplicate file names are found.

Default: True Example: true

Name
Description

UseZip64 : UseZip64Option

Always: Always use ZIP64 extensions when writing zip archives, even when unnecessary.

AsNecessary: Use ZIP64 extensions when writing zip archives, as necessary (when single entry or entries in total exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries).

Never: Do not use ZIP64 extensions when writing zip archives.

Possible values:

  • Always: Always use ZIP64 extensions.

  • AsNecessary: Use ZIP64 extensions when necessary.

  • Never: Never use ZIP64 extensions.

Default: AsNecessary Example: AsNecessary

Encoding : FileEncoding

Encoding for file and directory names.

Possible values:

  • UTF8: UTF-8 encoding.

  • ANSI: ANSI encoding.

  • ASCII: ASCII encoding.

  • WINDOWS1252: Windows-1252 encoding.

  • Other: Other enables users to add other encoding options as string.

Default: - Example: Encoding.UTF8

EnableBom : Boolean

Additional option for UTF-8 encoding to enable bom.

Default: - Example: true

EncodingInString : String

File encoding to be used. A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List.

Default: - Example: utf-8

ThrowErrorIfNoFilesFound : Boolean

Throw error if no source files are found. Otherwise returns object with FileCount: 0.

Default: True Example: true

DestinationFileExistsAction : FileExistAction

Choose action if destination zip file already exists.

Error: throws error.

Overwrite: Overwrites existing zip file with new one.

Rename: Renames new zip file (example.zip --> example_(1).zip).

Append: Adds new files to zip, if file already exists in zip, it is renamed.

Possible values:

  • Error: Throws an error.

  • Append: Adds new files to the existing zip.

  • Overwrite: Overwrites the existing zip.

  • Rename: Renames the new zip file.

Default: Error Example: Error

CreateDestinationFolder : Boolean

Create destination folder if it does not exist.

Default: False Example: false

ThrowErrorOnFailure : Boolean

Whether to throw an error on failure.

Default: True Example: true

ErrorMessageOnFailure : String

Overrides the error message on failure.

Default: - Example: Failed to create the archive

Task Result

Name
Description

Success : Boolean

Indicates if the task completed successfully. Example: true

Path : String

Full path to zip created. Example: c:\temp\zip_sample.zip

FileCount : Int32

Number of files in created zip file. Example: 1

ArchivedFiles : List<String>

List of files zipped. Example: TestFile.txt, TestFile2.txt

Error : Error

Error that occurred during task execution. Example: object { string Message, Exception AdditionalInfo }

Error.Message : String

Summary of the error. Example: Destination file c:\temp\sample.zip already exists.

Error.AdditionalInfo : Exception

Additional information about the error. Example: object { Exception AdditionalInfo }

Task Changelog

Changelog for Task Frends.Zip.CreateArchive.

[2.0.0] - 2026-11-03

Changed

  • [Breaking Change] Merged the Source and Destination parameter tabs into a single Input tab. Renamed Source.Directory to SourceDirectory, Destination.Directory to DestinationDirectory and Destination.FileName to DestinationFileName; other source and destination properties keep their names.

  • The Task result now includes Success and Error properties.

  • Added ThrowErrorOnFailure and ErrorMessageOnFailure options. By default the Task still throws an error on failure; when ThrowErrorOnFailure is disabled, the error is returned in the result instead.

  • Upgraded the Task to .NET 8.

[1.3.0] - 2025-12-29

Fixed

  • Fix repository url in metadata

[1.2.0] - 2024-12-13

Changed

  • Drop DotNetZip in favour of ProDotNetZip because of security reasons

  • DotNetZip has a HIGH severity directory traversal vulnerability (CVE reported Nov 2024) affecting versions 1.10.1 through 1.16.0 with no patch available (package is deprecated)

  • The migration to ProDotNetZip 1.20.0 addresses this security concern

[1.1.0] - 2023-11-27

Added

  • [Breaking] Added Encoding for file and directory names.

[1.0.0] - 2022-02-23

Added

  • Initial implementation

Last updated

Was this helpful?