Finding my way after getting lost

Things were busy at work at the end of July, and I didn’t get my invoices sent out. No problem, I thought, the first week of August will be fine. I had forgotten that I’d be traveling most of the first week of August, and travel usually means I’m extra busy the days before a trip.

So the bills had to go out this week, which was also fine—albeit less fine—but I had another problem. During the busy July—and going back into a kind of busy June—I had stopped updating my todo lists in Things. So I didn’t have a list of the projects that needed to be billed out. This meant trusting my memory, always fraught with peril, or…

Trusting find. I opened an iTerm window, cd’d into my ~/projects directory, and issued this command:

find . -name *report*.pdf -mtime -60

A few seconds later, I had a list of file paths to the reports I’d written in the couple of months. It looked sort of like this:


Because I always put the word “report” in the names of my reports, and they’re always PDF files, I knew that the first expression in my find command

-name *report*.pdf

would do the trick. The asterisks work just as you’d expect: they’re a wildcard globbing pattern. The second expression,

-mtime -60

restricted the results to files that were last modified (that’s what the m means) less than 60 days age. There are two parts of the -mtime expression that I find tricky:

  1. That the -mtime argument is given in days. There’s a similar expression -mmin, which works just like -mtime, but its argument is given in minutes—the units are built into the name. For consistency, I wish -mtime were called -mday.
  2. That the argument to -mtime needs a minus sign to mean “less than.” I tend to write -mtime 60, which finds only files that were modified exactly 60 days ago. Then when I get no results, I grit my teeth and rerun the command with the minus sign added.

Anyway, despite my quarrels with -mtime, I got the information I needed. Once I knew which projects I’d written a recent report on, I could check whether they’d been billed out. A couple had been, but most had not. That has since been fixed and a fiscal crisis averted.

A better solution to getting my invoices out on time would be to hop back on the Things wagon. That would better than dusting off my find skills again in September.