Tuesday, August 04, 2009

Unique file IDs

I write code to generate graphics. When I have a graphic I like, I save the image I've generated. In order to know exactly what code created that image, I like to save the code with the same name. As I gradually improve the code, the names evolve, with an addition of a descriptive word or with a version number. This all requires a kind of foresight (to know what description will be useful to my future self) and systematicness that I don't want to spend the time on. For now I've contented myself with a script that generates a unique time-based ID that I paste onto the end of the file names for the graphic and the code. The script copies the ID to my clipboard (requires OSX). Now all I need is a quicksilver trigger, and I can be more brainless than usual.

the code:
echo `date "+%Y%m%d_%H%M%S"` | pbcopy ; echo `pbpaste`

No comments: