{"id":599,"date":"2009-06-03T00:01:57","date_gmt":"2009-06-03T07:01:57","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=599"},"modified":"2009-05-31T09:58:55","modified_gmt":"2009-05-31T16:58:55","slug":"you-very-own-zip-file-creator-part-ii","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=599","title":{"rendered":"Your Very Own ZIP File Creator, Part II"},"content":{"rendered":"<p>Things get really nerdy when you create your own, new DOS command by using batch files. Warning: today&#8217;s blog post is <em>really<\/em> nerdy!<br \/>\n<!--more--><br \/>\nI wanted a single DOS command to create ZIP files. Sure, I could have downloaded WinZIP or some other ZIP utility. But I enjoy doing things myself \u2014 and then sharing the solutions with others.<\/p>\n<p>The solution I came up with for creating ZIP files, or Compressed Folders, at the command prompt is the <code>MKZIP<\/code> command. <code>MKZIP<\/code> builds empty ZIP files. Here&#8217;s how:<\/p>\n<p>First, I started with an empty ZIP file. I used Windows to create a Compressed Folder. I noticed that the new Compressed Folder, which is empty, occupies only 22 bytes of computer storage. That&#8217;s incredibly tiny, but also convenient: I can easily recreate those 22 bytes to make my own ZIP files. The problem is how?<\/p>\n<p>I used the <code>DEBUG<\/code> utility to look at the contents of the empty ZIP file.<\/p>\n<p><code>DEBUG<\/code> is an old, old DOS program. It&#8217;s actually an Assembler, used to create machine language code. I&#8217;ve written quite a few programs using nothing more than <code>DEBUG<\/code> and a knowledge of 8088 instruction code. I&#8217;ve also used <code>DEBUG<\/code> to debug my code.<\/p>\n<p>There are better tools than <code>DEBUG<\/code>, of course, but for creating tine programs or looking at the guts of a file, <code>DEBUG<\/code> is perfect.<\/p>\n<p>Here&#8217;s what I saw looking at the contents of the empty ZIP file in <code>DEBUG<\/code>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/05\/debug.png\" alt=\"debug\" title=\"debug\" width=\"660\" height=\"112\" class=\"alignnone size-full wp-image-601\" srcset=\"https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/05\/debug.png 660w, https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2009\/05\/debug-300x50.png 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/p>\n<p>Yes, it&#8217;s technical! The file is 22 bytes long, which translates into <code>0x16<\/code>. So the <code>DEBUG<\/code> command to list the ZIP file&#8217;s contents is:<\/p>\n<p><code>d100 l16<\/code><\/p>\n<p>That&#8217;s <code>D<\/code>, for Display, at memory location <code>100<\/code> for <code>L<\/code>, length, <code>16<\/code> bytes. The values are in hexadecimal. But the contents of the file is shown: Basically you have a <code>P<\/code> and a <code>K<\/code>, followed by the byte values <code>5<\/code> and <code>6<\/code> and then a bunch of zeros. That&#8217;s what an empty ZIP file looks like when it&#8217;s first created.<\/p>\n<p>What it all means is unimportant. The P and K probably have to do with <a href=\"http:\/\/en.wikipedia.org\/wiki\/Phil_Katz\">Phil Katz<\/a>, one of the early ZIP utility pioneers. The 5 and 6? Who cares! The zeros? I dunno! But all put together, the thing represents an empty ZIP file, which would be easy to duplicate.<\/p>\n<p>The next task is to create a script that can be fed into the <code>DEBUG<\/code> utility, a script that will use <code>DEBUG<\/code> to recreate a ZIP file. You&#8217;ll read about that script in the next blog post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Things get really nerdy when you create your own, new DOS command by using batch files. Warning: today&#8217;s blog post is really nerdy!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-599","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=599"}],"version-history":[{"count":6,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/599\/revisions"}],"predecessor-version":[{"id":640,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/599\/revisions\/640"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}