Zip and unZip files and directories: Difference between revisions
Jump to navigation
Jump to search
Example-1. Unzip a
(imported material) |
(imported material + synt hilight) |
||
Line 1: | Line 1: | ||
You need to ensure you have loaded the appropriate package, then you can follow the examples below. |
You need to ensure you have loaded the appropriate package, then you can follow the examples below.<syntaxhighlight lang="smalltalk"> |
||
Feature require: 'Compression'. |
|||
</syntaxhighlight> |
|||
=== Example-1. Unzip a <code>*.zip</code> file representing a directory === |
=== Example-1. Unzip a <code>*.zip</code> file representing a directory === |
||
<syntaxhighlight lang="smalltalk"> |
|||
⚫ | |||
zipFile := '/home/p/download/testDir.zip'. |
|||
ZipArchive new readFrom: zipFile ; extractAllTo: '/home/p/download/testDir' asDirectoryEntry . |
|||
</syntaxhighlight> |
|||
=== Example-2. See what is inside a *.zip file === |
=== Example-2. See what is inside a *.zip file === |
||
<syntaxhighlight lang="smalltalk"> |
|||
zipFile _ '/home/p/download/testDir.zip'. |
|||
⚫ | |||
za := ZipArchive new readFrom: zipFile. za members . |
|||
za members . |
|||
</syntaxhighlight> |
|||
=== Example-3. TODO. Zip a file or directory === |
=== Example-3. TODO. Zip a file or directory === |
Latest revision as of 22:17, 4 May 2025
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 .