ZipFile

Summary

Use the ZipFile function to compress files and directories located on the Connect SFTP file system. The function supports ZIP compression. The function can compress a single source file, all files in a directory, or recursively all files and subdirectories found under a parent directory.

Syntax

ZipFile(FilePath='<path to source file> OR Directory=<source dir path>',
    Destination='<target zip file location>'
    [, Overwrite=<true|false>]
    [, Recursive=<true|false>])

Parameters

Parameter Description
FilePath (Required) Use either the FilePath or Directory parameters, but not both, to indicate the source file or directory to compress. Use FilePath to compress a single file into the destination ZIP file. Specify either the source file name (if found in the root directory) or the entire directory path to the source file.

For example:

  • FilePath=’my_source_file.csv’
  • FilePath=’/my_source_file.csv’
  • FilePath=’/a_dir/a_sub_dir/my_source_file.csv’
Directory (Required) Use either the FilePath or Directory parameters, but not both, to indicate the source file or directory to compress. Use Directory to compress all files found in a directory. Use the Recursive parameter to recursively compress all files and subdirectories found in the source directory.

For example:

  • Directory=’/file_extracts’
  • Directory=’/file_extracts/emea’
  • Directory=’/file_extracts/us/west’
Destination (Required) The target ZIP directory path and file name. The function creates the directory structure and target ZIP file automatically if they do not already exist. It is necessary to specify the name of the target ZIP file.

For example:

  • Destination=’/outbound_files/payfile.zip’
  • Destination=’hr_data_extracts.zip’ — Writes to the root SFTP directory.
  • Destination=’/hr_data_extracts.zip’ — Also writes to the root SFTP directory.
Overwrite (Optional) Overwrite the target ZIP file if it already exists on the SFTP file system. The default is false. Do not surround true or false in single quotes.
Recursive (Optional) Used with the Directory parameter to recursively compress all files and subdirectories found in the source directory. The default is false. Do not surround true or false in single quotes.

Return Type

The function creates a new target ZIP file and the directory path on the Xactly SFTP server file system. The function returns a status result set containing information for each source file included in the target ZIP file.

Details

Connect is integrated with the Xactly SFTP server, connectftp.xactlycorp.com.

Connect file commands can read and write files and manipulate directory structures located on the SFTP file system. An SFTP account is not required to use these commands. However, an account is required to access the file system using SFTP clients. Contact Xactly Customer Support to set up an SFTP account, if necessary.

You can use an SFTP client to get and put files on the Xactly SFTP server. Valid SFTP login credentials are required to transfer files using SFTP. Connect users, however, do not need SFTP credentials to use Connect file functions with files located on the SFTP server.

Examples

call ZipFile(FilePath='/extracts/payfile.csv', 
    Destination='/outbound_files/payfile.zip',
    Overwrite=true);

call ZipFile(Directory='/extracts', 
    Destination='/outbound_files/all_the_files_and_dirs.zip',
    Overwrite=true,
    Recursive=true);

Related Functions

UnzipFile
WriteFile