My FNZ Studio Version

Extensions

Latest Update: 13.11.2024 | Margherita Taffarel
Documentation
2024

1 Introduction

The ArchivingTools Extension provides secure ZIP and UNZIP Script Functions.

2 Usage

2.1 ZipProtected Script Function

  • ZipProtected
    Packages the content of a directory in a ZIP file. Please, note that the directory itself is not added to the ZIP file. If the target ZIP file already exists, it is overwritten. Relative paths are treated as relative to the Data Home directory. If a password is provided, the ZIP file is protected with it.

    Parameters

    • (String) $directoryPath. Path to the directory.
      Example: work/tmp/docs
    • (String) $zipFilePath. Path to ZIP file.
      Example: work/tmp/docs.zip
    • (String, Optional) $password. Password to apply. If the password is not provided, the compressed file is not protected.
      Example: aPassword

    Return (Integer)
    Number of packaged files and directories.

    Example
    ZipProtected(work/tmp/docs,work/tmp/docs.zip)

2.2 UnzipProtected Script Function

  • UnzipProtected
    Extracts the content of a ZIP file into a directory. The third, optional parameter may be used to extract only a single file or sub-directory. If the target directory does not exist, it is created. Relative paths are treated as relative to the Data Home directory. If a password is provided, the ZIP file is uncompressed using it, otherwise a standard uncompress action is performed.

    Parameters

    • (String) $zipFilePath. Path to ZIP file. It can be the relative path to the data home directory.
      Example: work/tmp/uploads/docs.zip
    • (String) $directoryPath. Path to directory where the ZIP file is extracted. It can be the relative path to the data home directory.
      Example: work/tmp/docs
    • (String, Optional) $entryPath. Path to file or directory inside the ZIP file. Use an empty string to extract all files.
      Example: misc/faq.txt
    • (String, Optional) $password. Password to uncompress file.
      Example: aPassword

    Return (Integer)
    Number of extracted files and directories. If the output directory is not empty, the number is affected by the initial content of the target directory.

    Example
    UnzipProtected(work/tmp/uploads/docs.zip,work/tmp/docs)

2.3 Examples

String $dirToCompress := '/data/work/tocompress';
String $zipFile := '/data/work/test.zip';
String $dirWhereToUncompress := '/data/work/new';

ZipProtected($dirToCompress, $zipFile,"aPassword");
UnzipProtected($zipFile, $dirWhereToUncompress,'',"aPassword");

3 Further Sources

© 2026 Appway AG. All Rights Reserved