{"id":34582,"date":"2025-08-08T19:15:57","date_gmt":"2025-08-09T00:15:57","guid":{"rendered":"http:\/\/www.allyngibson.com\/?p=34582"},"modified":"2025-08-08T19:15:57","modified_gmt":"2025-08-09T00:15:57","slug":"see-a-problem-solve-a-problem","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=34582","title":{"rendered":"See a Problem, Solve a Problem"},"content":{"rendered":"<p>At Diamond archiving files for the retailer website is often a convoluted and tedious manual process.<\/p>\n<p>For example, the order form files &#8212; my purview &#8212; go in these two directories <i>here<\/i> (depending on if they are text or PDF), then they are archived in directories <i>here<\/i> (again, text or PDF depending) under their &#8220;standard&#8221; file names, then they are archived <i>here<\/i> and renamed with a YYYYMM nomenclature in separate directories depending on what the file is and the data it contains.  There&#8217;s nothing hard about it, it&#8217;s just a bit tedious and takes all of about half an hour, mainly spent on the file renaming for the individual directories.<\/p>\n<p>And then, sometimes, one of my colleagues would decide he would archive one of my files, which would throw my process off entirely because I&#8217;d see an archived file and think, &#8220;Oh, I must have already done the archiving since the file is here.&#8221;  (The archiving would happen first thing in the morning, when the coffee is still kicking in.)<\/p>\n<p>A few years ago <a href=\"http:\/\/www.allyngibson.com\/?p=34344\">I became interested in learning Python<\/a>, the scripting language.  I saw a few places where Python could automate work processes, and one of those processes was my monthly archiving.  I had a system in place &#8212; I have staging folders, I copy the files to where they need to go with drag-drop, and I rename the files I need to rename.  Python could do this!<\/p>\n<p>Alas, my work computer did not have Python installed, and I didn&#8217;t see it as an issue sufficiently worth raising with IT.<\/p>\n<p>But then I had a second thought.  An old-school DOS batch file would work just as well, and running that didn&#8217;t require installing anything.  It&#8217;s just a part of Windows and DOS going back to the early 1980s.<\/p>\n<p>I spent an afternoon writing a macro for Microsoft Word that would build a new, custom batch file each month.  Two, three hours&#8217; worth of work, all to save myself half an hour each month.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"842\" src=\"http:\/\/www.allyngibson.com\/wp-content\/uploads\/2025\/08\/Screenshot_20250728_135014.jpg\" alt=\"Screenshot of my VBA macro code that builds the batch file\" class=\"aligncenter size-full wp-image-34581\" \/><\/p>\n<p>I updated the script last month so I could automatically archive another file I create that went on a different server with a different file name structure.<\/p>\n<p>The thing that makes it work is Windows&#8217; ability to assign network locations to drive letters.  I mapped one network location as the R: drive, another location as the S: drive, and the <code>copy<\/code> command doesn&#8217;t care that my batch script sends files to a network location.<\/p>\n<p>Automatically archiving my monthly order form files is not the greatest or most useful problem in the world to solve, and I wondered if the reward (saving a few minutes each month) was worth the initial investment of time, but it was nice little project to undertake and I felt good coming up with a way to automate it as much as possible with the tools I had.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At Diamond archiving files for the retailer website is often a convoluted and tedious manual process. For example, the order form files &#8212; my purview &#8212; go in these two directories here (depending on if they are text or PDF), then they are archived in directories here (again, text or PDF depending) under their &#8220;standard&#8221;<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=34582\">Continue reading <span class=\"screen-reader-text\">&#8220;See a Problem, Solve a Problem&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[229],"tags":[4846,5267,426],"class_list":["post-34582","post","type-post","status-publish","format-standard","hentry","category-work","tag-diamond-comic-distributors","tag-microsoft-windows","tag-microsoft-word","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/34582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34582"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/34582\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34582"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}