zip extract all

Prev Next

Function Names

zip extract all

Library

Zip Library

Description

Extracts the whole archive and stores the contents in a dedicated directory. The directory structure depicted in the archive will be used to build up the necessary structure in the target directory.

Call as: procedure

Restrictions

Under normal conditions, the 'Zip Library' is loaded automatically, so no 'include(...)' call is needed.

Parameter count

1-2

Parameters

No.TypeDescription
1.
input
string Archive file name

Choice of file or directory name. If directory name is chosen, then the whole directory with all contents will be compressed. Wildcards e.g. (pictures\*.jpg) are allowed. In this case, 2nd parameter (Archive file name) is also required to provide a concrete archive name.

Opt. 2.
input
string Target directory name

Specify the directory where the extracted files shall be copied to.

Default value: (current working directory)

Examples

               include( Zip Library );

               zip compress( "Examples\*.csv", "All csv.zip" );
               zip extract all( "All csv.zip", "My Dir" );

               echo("List the extracted file from 'All csv.zip':", new line);
               directory listing recursive( d, "My Dir" );
               table keep columns( d, {Path,Name,Date Created,Directory,Size} );
               table list( d );

               directory delete recursive ( "", "My Dir" );
               file delete( "All csv.zip" );

Output

List the extracted file from 'All csv.zip':

    0 : Path             | Name                               | Date Created | Directory | Size
    1 : My Dir\          | Examples\                          | 2024-10-19   | Yes       | 0   
    2 : My Dir\Examples\ | Cities.csv                         | 2024-02-11   | No        | 1035
    3 : My Dir\Examples\ | Soccer Membership List.csv         | 2024-02-11   | No        | 431
    4 : My Dir\Examples\ | Table Explore Demo.csv             | 2024-02-11   | No        | 472
    5 : My Dir\Examples\ | Table Lookup Example 1.csv         | 2024-02-11   | No        | 542
    6 : My Dir\Examples\ | Table Lookup Example 2.csv         | 2024-02-11   | No        | 571
    7 : My Dir\Examples\ | Table Merge Examples Hillboro.csv  | 2024-02-11   | No        | 294
    8 : My Dir\Examples\ | Table Merge Examples Hillville.csv | 2024-02-11   | No        | 263
    9 : My Dir\Examples\ | Table Merge Examples Hobbies 1.csv | 2024-02-11   | No        | 161
   10 : My Dir\Examples\ | Table Merge Examples Hobbies 2.csv | 2024-02-11   | No        | 215
   11 : My Dir\Examples\ | Table Validate Reference In.csv    | 2024-02-11   | No        | 493
   12 : My Dir\Examples\ | Table Validate Target In.csv       | 2024-02-11   | No        | 685
   13 : My Dir\Examples\ | Tennis and Golf Players.csv        | 2024-02-11   | No        | 300

Try it yourself: Open LIB_Function_zip_extract_all.b4p in B4P_Examples.zip. Decompress before use.

See also

zip extract files
zip compress