{"id":597,"date":"2009-06-01T00:01:02","date_gmt":"2009-06-01T07:01:02","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=597"},"modified":"2009-05-31T10:00:12","modified_gmt":"2009-05-31T17:00:12","slug":"you-very-own-zip-file-creator-part-i","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=597","title":{"rendered":"Your Very Own ZIP File Creator, Part I"},"content":{"rendered":"<p>I warn you: This blog entry is nerdy and technical! It&#8217;s not for the beginner!<br \/>\n<!--more--><br \/>\nWhen I first started writing computer books a century ago, I made a good living writing about DOS batch files. My batch file books were famous. I once got a phone call from a Microsoft employee who kept my batch file book locked in his desk drawer!<\/p>\n<p>Knowing about batch files, and how DOS worked, was important to getting the most from your PC years ago. Here&#8217;s a secret: It&#8217;s important today as well.<\/p>\n<p>Microsoft has been working on improving the batch file programming abilities in Windows, a little bit with each version. The depth and abilities of batch files in Windows Vista is pretty impressive. To prove it, just type <code>HELP IF<\/code> at the command prompt to see a slew of improvements to what was once a pretty simple little command.<\/p>\n<p>In my work, I create a lot of ZIP file archives, Compressed Folders that contain the chapters and graphics I send to my publisher. The problem is creating those folders.<\/p>\n<p>You create a Compressed Folder icon in a folder window by right-clicking the window, then choosing New > Compressed (zipped) Folder from the pop-up menu. Doing that over and over to create multiple compressed folders is a pain \u2014 and computers are designed to make repetitive tasks easy, right?<\/p>\n<p>The solution I use is to create one Compressed Folder using the above methods. Then I open a Command Prompt window and duplicate the one Compressed Folder several times by using the DOS <code>COPY<\/code> command. Even that method is contrived.<\/p>\n<p>While duplicating Compressed Folders recently, it dawned on me that there must be a make-zip type of command somewhere in Windows. There isn&#8217;t. The only solution Microsoft offers is to write a very long shell script that I found obtuse. That got me to thinking how I could best create a new ZIP file using my old friend the batch file.<\/p>\n<p>A batch file is really nothing more than a collection of DOS commands, all stacked on top of each other, one line at a time, in a text file. The text file is named with the <code>BAT<\/code> filename extension, which makes it a batch file, an executable file in Windows.<\/p>\n<p>You &#8220;run&#8221; a batch file by typing its name at the command prompt. The command interpreter then takes each command in the text file, runs it, and moves on to the next command.<\/p>\n<p>There are various programming tools you can use in a batch file, such as <code>IF<\/code> for decision making and <code>GOTO<\/code> for branching execution. You can also use variables and such.<\/p>\n<p>In my books, I wrote about augmenting batch files with the DOS <code>DEBUG<\/code> tool, various helper programs I wrote, and so on. My solution for the create-zip command includes all those tricks, but you&#8217;ll have to wait to my next post to read about it and how it works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I warn you: This blog entry is nerdy and technical! It&#8217;s not for the beginner!<\/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-597","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\/597","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=597"}],"version-history":[{"count":5,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}