# Making a new year

I know it may seem as if I’m ready to throw in the towel on blogging—only 78 posts last year, and 15 of those were in January—but I’m not. Last year was very busy in both my professional and personal life, and my internet life had to take a back seat because of that. Also, there is the siren song of Twitter, which makes it so easy to say nearly what you want, especially if you’re willing to cheat and let your thoughts spill over into a second or third tweet.1 My goal for the year is to focus my tweeting on stupid jokes and replies to stupid jokes. Other stuff should go here, even when it’s relatively short.

Like this post would have been if I hadn’t done so much throat-clearing in the first paragraph.

To start the blogging year, I needed to make this year’s folder and monthly subfolders for the Markdown source files. This isn’t hard to do in the Finder, but it’s much more fun to do it in the Terminal. I go to the source directory and issue these commands

mkdir 2017
cd 2017
jot -w %02d 12 | xargs mkdir


The “2017” in the second line doesn’t have to be typed out: Escape-period (⎋.) is the shortcut that enters the final item of the last line into the current line, much like typing ↑ enters entire previous command. And like ↑, typing ⎋. repeatedly works backward through your command history, entering the final item of each previous line in turn.

The interesting line, and the one that’s the most fun, is the third line, which populates the 2017 folder with subfolders for each month, like this:

The jot command prints out the numbers from 1 to 12, with the -w %02d switch formatting the single-digit numbers with a leading zero (the -w switch uses the printf formatting directives). Then the xargs command takes that output and turns it into arguments for mkdir, which creates all the subdirectories. Boom.

For many years, I thought xargs was this really complicated command that only true Unix wizards could control. And while it can be used in complex ways, it is at heart a pretty simple utility. It’s sort of like a pipe, but instead of turning the standard output of one command into the standard input of another, it turns that standard output into a list of arguments for the second command. Once I understood that concept, it didn’t scare me anymore.

1. Strings of tweets longer than that are an abomination, worse than a textshot of your own words. When I see someone tweeting “Thread,” I stay away.