[Kevin Walzer] I've been looking for a pure-Tcl solution to create zip archives, and stumbled across [JCW]'s "zipper" package, documented at http://www.equi4.com/critlib/zipper.README. It's part of his critlib package at http://www.equi4.com/critlib/. I'm a bit surprised that this extension isn't more widely discussed or used, because it appears to offer a foundation for writing a [tcllib] extension similar to [tar]. Here's a sample: package require zipper zipper::initialize [open try.zip w] zipper::addentry dir/file.txt "some data to store" close [zipper::finalize] This will create a zip archive called "try.zip" with "file.txt," whose contents are "some data to store." Mounting the archive with a tool like WinZip or, more appropriately, the [tclvfs] package ([vfs::zip]) confirms the contents of the file. I was curious if one could copy an existing file to a zip file with zipper, and it seems you can. I tried a jpeg, and it worked fine. Use code similar to this: package require zipper set f [open somefile.jpg r] fconfigure $f -translation binary zipper::initialize [open try.zip w] zipper::addentry somefile.jpg [read $f] close $f close [zipper::finalize] This works by reading the jpeg file as a binary stream, then writing the data to a file of the same name in the zip archive. By contrast, with the tclvfs extension, you can copy a file from the virtual file system (in this case a zip archive) to your local directory using the [file copy] command. One thing zipper does not do is append files to an existing zip archive--I have not found a way to do that. ((Using the command "open try.zip a" simply overwrote the contents of the existing zip archive.) If you want to append files you will probably need to do a workaround by writing the contents of an existing zip archive to a temporary directory, adding whatever files you want to that directory via [file copy], then writing each file back to a new zip archive with the same name via zipper. This might be slow if you have a lot of files or they are large. I'm thinking about writing a little GUI utility that will simplify the creation and viewing of zip archives, and the zipper command set will likely be an integral part of it. ---- [MHo], 2007-Oct-09: I noticed a time difference of -2 hours after adding some files with ''addentry... [[file mtime sourcefile]]'' (WinXP, daylight saving time active, germany)... Can someone confirm this behaviour? I can't remember details, but the 2 hours-delta-problem with NTFS sounds somewhat familiar... Meanwhile I found the possible reason for one hour in '''zipper.tcl''': proc dostime {sec} { set f [clock format $sec -format {%Y %m %d %H %M %S} -gmt 1]; ########################### -gmt 1 regsub -all { 0(\d)} $f { \1} f foreach {Y M D h m s} $f break set date [expr {(($Y-1980)<<9) | ($M<<5) | $D}] set time [expr {($h<<11) | ($m<<5) | ($s>>1)}] return [list $date $time] }