Skip to main content

The "xzip_set_readonly" Function

Syntax#

xzip_set_readonly(arch, enable, file1, [file2], ...);
ArgumentTypeDescription
archstringThe full path and filename of the archive to modify
enablebooleanSets whether to enable or disable the read-only flag
file1string/integer/array/keywordThe name or index of a file to modify, or array of files (or keyword 'all' for all files)
[file2]stringOptional: Additional files to modify (arrays and keywords not accepted)

Description#

Enables or disables flagging files as read-only within the given archive created with xzip_create. Files flagged as read-only cannot be overwritten, deleted, renamed, or moved without first disabling the read-only flag.

If a folder is input, all files inside will be modified.

Also returns true or false to indicate if the operation succeeded or failed.

note

If multiple files are input, even a single error will return false even though other files succeeded. In this scenario, use xzip_report to retrieve a list of failed files.

Example#

xzip_set_readonly("C:\\archive.xz", true, all);
xzip_set_readonly("C:\\archive.xz", false, "file1.txt", "file3.png");

This will make all files read-only except "file1.txt" and "file3.png".