--- ZDIR - show .ZIP content in directory format / TOUCH files within ---
Displays files within .ZIP in "directory format"
 simpler/nicer looking than most ZIP utilities.
 unlike Windows - show original DOS timestamps (not adjusted for DST)

Also, can TOUCH (set timestamp) of files within .ZIP

I do this because I've always liked setting the TIME in files of products I
release to reflect the software Version Number.

With "modern" systems not supporting 16-bit DOS applications, I work more and
more in DosBox these days, but it does NOT support INT 21-5701, preventing my
usual TOUCH tool from setting the timestamp of origional files.

So.. I use ZDIR to set timestamps after ZIPping them for distribution!

There are no guarantees - The .ZIP file format is fairly complex and there
appear to be "features" not used within DOS - see below for information on
what I've "figured out" so far.

ZDIR seems to work well with the .ZIPs I've created for my various DOS tools.
I generally use a "registered" version of PKZIP 2.04g under DOS to create the
.ZIP archives.


--- UTC/DST ---
If you look in .ZIP within Windows (possible other OSs too), be aware that
it seems to adjust the displayed Time based on the UTC timezone of Date.
PKZIP/DOS didn't do this!
eg: Simple X.ZIP containing TST.DAT

>zdir X *=1-2-3
2024-07-25  7:37:06          256 TST.DAT =2001-02-03  7:37:06
3+3 entries adjusted!

>zdir X
2001-02-03  7:37:06          256 TST.DAT

> pkunzip -v X
 Length  Method   Size  Ratio   Date    Time    CRC-32  Attr  Name
 ------  ------   ----- -----   ----    ----   -------- ----  ----
    256  DeflatX     16  94%  02-03-01  07:37  49975b13 --w-  TST.DAT

> WINDOWS double-click X.ZIP
Name            Size    Date modified
[]TST.DAT       1 KB    2001-02-03 6:37 AM


Use ZDIR to view DOS .ZIPs to see actual file timestamps!


--- Technical Information ---
ZDIR basically follow the structures within the .ZIP, matches filenames,
and changed the Time&Date fields - pretty much everything else is just copied
"as is".

Here's what I have worked out about the records found in a .ZIP file.
Some of this is from experimentation, some from what documentation I could
find "on the web".

1-File entries:
    ID(B2):             'P','K' Identifies as a .ZIP file
    RecortType(W):      0403
    Version(W):         Changes with different editions of PKZIP
    Flags(W - bits):    Encrypt0 Option1 Option2 Descrip3 EXdeflt4 Patch5
                        Strong6 Lang11 Mask13
    CompressType(W):    None00 Shrink01 Level102 Level203 Level304 Level405
                        Implode06 Deflat08 EXdeflat09 PKdcl10 Bzip212 Lzma14
                        IBMterse18 IBMlz7719 PPMd98
    Time(W)             DOS format
    Date(W)             DOS format
    CRC(L)
    CompSize(L)
    OrigSize(L)
    NameSize(B)
    ExtraSize(B)
    NameData(B NameSize)
    ExtraData(B ExtraSize)
    CompressedFileData(B CompSize)
    *Descriptor(B12)    *Only if Flags.3 set

2-Master Directory Entries:
    ID(B2):             'P','K' Identifies as a .ZIP file
    RecortType(W):      0102
    Origin(W)           Archiver that made .ZIP?
    Version(W):         Changes with different editions of PKZIP
    Flags(W - bits):    see "File Entries"
    CompressType(W):    ""
    Time(W)             DOS format
    Date(W)             DOS format
    CRC(L)
    CompSize(L)
    OrigSize(L)
    NameSize(W)
    ExtraSize(W)
    CommentSize(W)
    Disk#(W)
    LocalAttributes(W)
    HostAttributes(L)
    OffsetToLocalHeader(L1)
    NameData(B NameSize)
    ExtraData(B ExtraSize)
    CompressedFileData(B CompSize)

Dave Dunfield   -   https://dunfield.themindfactory.com
