Return to index

zip functions

bool = zip_add(zip_filename, files)

top

Add files to existing ZIP archive.

Example:

# Example for zip_add
zip_create("/tmp/za_test.zip", [])
write_file("/tmp/za_test.txt", "hello")
zip_add("/tmp/za_test.zip", ["/tmp/za_test.txt"])


bool = zip_create(zip_filename, files)

top

Create ZIP archive from list of files.

Example:

# Example for zip_create
zip_create("/tmp/za_test.zip", [])


bool = zip_create_from_dir(zip_filename, dirpath)

top

Create ZIP archive from directory contents.

Example:

# Example for zip_create_from_dir
d = temp_dir("za-zip-")
write_file(d + "/a.txt", "hello")
zip_create_from_dir("/tmp/za_test_dir_temp.zip", d)


bool = zip_extract(zip_filename, dest_dir)

top

Extract ZIP archive to destination directory.

Example:

# Example for zip_extract
zip_create("/tmp/za_test.zip", [])
write_file("/tmp/za_test.txt", "hello")
zip_add("/tmp/za_test.zip", ["/tmp/za_test.txt"])
zip_extract("/tmp/za_test.zip", "/tmp/za_zip_out")


bool = zip_extract_file(zip_filename, files_to_extract, dest_dir)

top

Extract specific files from ZIP archive to destination directory.

Example:

# Example for zip_extract_file
zip_create("/tmp/za_test.zip", [])
write_file("/tmp/za_test.txt", "hello")
zip_add("/tmp/za_test.zip", ["/tmp/za_test.txt"])
zip_extract_file("/tmp/za_test.zip", ["/tmp/za_test.txt"], "/tmp/za_zip_single.txt")


[]string = zip_list(zip_filename)

top

List contents of ZIP archive.

Example:

# Example for zip_list
zip_create("/tmp/za_test.zip", [])
write_file("/tmp/za_test.txt", "hello")
zip_add("/tmp/za_test.zip", ["/tmp/za_test.txt"])
println zip_list("/tmp/za_test.zip")


bool = zip_remove(zip_filename, files)

top

Remove files from ZIP archive.

Example:

# Example for zip_remove
zip_create("/tmp/za_test.zip", [])
write_file("/tmp/za_test.txt", "hello")
zip_add("/tmp/za_test.zip", ["/tmp/za_test.txt"])
zip_remove("/tmp/za_test.zip", ["/tmp/za_test.txt"])