links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Zip up a complete directory structure
Last updated at 12:46 pm UTC on 17 February 2018
Zip up a complete directory structure and place the zip in the parent directory.

(as Winzip does from the explorer menu choice).
Anyone care to add a menu item in FileList? :-)

 | archive |
 dirName := 'd:\images'.
 archive := ZipArchive new.

 dir := FileDirectory on: dirName.

 dir fullNamesOfAllFilesInSubtree do:[:fn|

 	entry := archive addFile: fn as: (fn last: (fn size - dirName size - 1)).

 	entry desiredCompressionMethod: ZipArchive compressionDeflated.

 archive writeToFileNamed: (dir containingDirectory fullNameFor: dir localName, '.zip'); close.