At Diamond archiving files for the retailer website is often a convoluted and tedious manual process.
For example, the order form files — my purview — 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 “standard” file names, then they are archived here and renamed with a YYYYMM nomenclature in separate directories depending on what the file is and the data it contains. There’s nothing hard about it, it’s just a bit tedious and takes all of about half an hour, mainly spent on the file renaming for the individual directories.
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’d see an archived file and think, “Oh, I must have already done the archiving since the file is here.” (The archiving would happen first thing in the morning, when the coffee is still kicking in.)
A few years ago I became interested in learning Python, 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 — 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!
Alas, my work computer did not have Python installed, and I didn’t see it as an issue sufficiently worth raising with IT.
But then I had a second thought. An old-school DOS batch file would work just as well, and running that didn’t require installing anything. It’s just a part of Windows and DOS going back to the early 1980s.
I spent an afternoon writing a macro for Microsoft Word that would build a new, custom batch file each month. Two, three hours’ worth of work, all to save myself half an hour each month.
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.
The thing that makes it work is Windows’ 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 copy
command doesn’t care that my batch script sends files to a network location.
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.