zip_extract()

Read(5636) Label: zip, file extraction,

Description:
Extract one or more files from a zip file.

Syntax:
zip_extract(
zip, files, path)

Note:

The external library function (See External Library Guide) extracts one or more specified files from a zip file to a path and returns a list of successfully extracted files.

Parameter:

zip

A zip file object

files  

A compressed file or a file object; can be a sequence

path

A path, which can be an absolute one or a relative one

Option:

@s

Extract files from both the current directory and its subdirectories of the compressed file; extract files only from the current directory by default

Return value:

File list

Example:

 

A

 

1

=zip_open("D:/z2.zip")

Open a zip file.

2

=zip_extract(A1,"*.txt")

Extract txt files into D:/ directory holding the zip file

3

=zip_extract(A1,"*.csv","D:/csvfile")

Extract csv files into D:/csvfile directory.

4

=zip_extract@s(A1,"empinfo.csv","D:/csvfile/file1")

Extract empinfo.csv under z2.zip’s subdirectory to D:/csvfile/file1.

5

>zip_close(A1)

Close a zip file.