Zip and unZip files and directories

From Cuis CookBook
Jump to navigation Jump to search

You need to ensure you have loaded the appropriate package, then you can follow the examples below.

Feature require: 'Compression'.

Example-1. Unzip a *.zip file representing a directory

zipFile := '/home/p/download/testDir.zip'. 
ZipArchive new readFrom: zipFile ; extractAllTo: '/home/p/download/testDir' asDirectoryEntry .

Example-2. See what is inside a *.zip file

zipFile := '/home/p/download/testDir.zip'. 
za := ZipArchive new readFrom: zipFile. za members .

Example-3. TODO. Zip a file or directory