Zip Files

Verb: zip

Available from: <Standard>

Compresses files from a directory and/or subdirectories into a ".zip" file.

Syntax

zip --directorylocation(String) --destinationfolder(String) --filename(String) [--filemask(String)] [--scansubdirectories(Boolean)]

Inputs

Script Designer Required AcceptedTypes Description
--directorylocation Files Directory Required Text Directory where the files that should be compressed are located at.
--destinationfolder Destination Directory Required Text Destination directory to which the compressed files go to.
--filename File Name Required Text Name assigned to the ".zip" file.
--filemask File Filter Optional Text Filters by file extension, full name or a character that makes up the file name. The filter formats are:
  • .Extension: Filters by extension. Example: *.xlsm filters files with the Excel extension (xlsm).
  • character: Filters by the initial file name. Example: "do" filters files that start with "do".
  • --scansubdirectories Find Subdirectories Optional Boolean When enabled, also searches for the files in the existing subdirectories from the main directory inserted in the Files Directory parameter and compresses them.

    Example

    The Zip Files command compresses the files in the "Desktop", obtained by the command Get System Folder Path, storing them in a ".zip" file in the defined destination directory.

    defVar --name desktop --type String
    defVar --name createdDirectory --type String
    // Get the path to the desktop directory.
    getSpecialFolder --folder "Desktop" desktop=value
    // Create a directory for testing on the desktop.
    createDir --path "${desktop}\\Test Folder" createdDirectory=value
    // Create a file and save it in the created directory.
    writeToFile --value "This file was generated only for demonstrating the command \"Compress Files\"." --file "${createdDirectory}\\testFile"
    // Uses the directory of the file created previously to compress its contents and saves the compressed file on the desktop.
    zip --directorylocation "${createdDirectory}" --destinationfolder "${desktop}" --filename "Compressed File"
    

    See Also

  • Unzip files