Skip to main content

The "xzip_delete" Function

Syntax#

xzip_delete(arch, file1, [file2], ...);
ArgumentTypeDescription
archstringThe full path and filename of the archive to modify
file1string/integer/array/keywordThe name or index of a file to delete, or array of files (or keyword 'all' for all files)
[file2]string/integerOptional: Additional files to delete from the archive (arrays and keywords not accepted)

Description#

Checks if one or more files exist in the given archive and deletes them. If a folder is supplied, all contents of the folder will be deleted.

Also returns true or false to indicate if the operation succeeded or failed. Note that this includes failure to delete a file flagged as read-only. (This can be determined with xzip_get_readonly.)

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.

For files stored in the archive, a full path should not be used, just the file name with extension. Use xzip_list to see what file names are available in the archive. The numerical index from xzip_list, an array, or the all keyword can also be used.

Also note that this script does not delete the archive itself! For that, use the built-in file_delete function.

Be warned that deletion takes time, and deleting many files at once can cause the game to temporarily appear frozen.

Example#

xzip_delete("C:\\archive.xz", "file1.txt");
xzip_delete(my_zip, "file2.gif", "my\\sub\\folder");