*(This post is a part of a series on Keyboard Maestro, [see more here](http://brooksreview.net/tag/KM-SERIES/).)*
This macro will allow you to select any file in Mac OS X and append the current date to the end of the file name. It is all done with one keyboard shortcut and no need to get to the editing file name mode. This is very useful for versioning files if you work outside of a version control system — or if you get a lot of files with the same name (images are one I constantly add this info to).
*What you need: Keyboard Maestro and Automator.*
## How To
We need to start in Automator and build a new workflow.
1. Open Automator and when prompted to create a new file select `Workflow`.
2. In the search field to the left, search for the action named `Get Selected Finder Items`. Drag that to the pane on the right.
*This action will tell Automator that we are working with the files you have selected and only those files.*
3. Search for another action named `Rename Finder Items` and drag it to the right pane. When prompted to add an action to copy the file first select `Don’t Add`.
Once you have this action in there you will be presented with a multitude of options to consider. Here’s how I have mine setup:
There’s some important things to note:
– Be sure to use spaces, dashes, or underscores for the separators so that you don’t break non-Mac tools (other operating systems and websites hate the forward slashes).
– You have four options of the date to grab: Created, Modified, Last Opened, Current. All the options work as expected, but the first three may not always result in the date you intended it to, for that reason I stay with the current date.
– `Use Leading Zeros` just means that August will be represented as `08` instead of `8`. I recommend turning this on for a more consistent file length.
4. Now you just need to save the workflow somewhere you remember and somewhere that you will not move it. (I have a dedicated Dropbox folder that I keep these workflows in.)
5. Open Keyboard Maestro and create a new Macro (CMD+n).
6. Set the trigger to `This hot key:`. Next you will need to click on the field below to record your new keyboard shortcut, personally I chose: `Control+Shift+Command+R`. Make sure `Is pressed` reads after the shortcut.
7. Next click to add a new action and search for `Execute an Automator Workflow`. Drag that action to the pane on the right to add it.
8. Click the button with the ellipses on it (the three dots) and select the workflow that you just saved in step 4.
You are now done. With a file selected you should be able to press your keyboard shortcut and have the date appended to it.
*Note: Pressing the shortcut more than once on any file will keep appending the date, be careful.*
You may have noticed that Automator doesn’t actually allow you to append the Date **and** Time to a file name — at least not in one fell swoop. This is easily added by opening the workflow back up in Automator and making these tweaks:
– Add another copy of `Rename Finder Items`, again selecting `Don’t Add` when prompted.
– Change the format from the date, to the the time and adjust settings to your liking.
This will now append the date first, followed by the time, and then the file extension. If you want the two reversed, simply drag the Time action above the Date action.
The nice part is that we don’t need to change anything in Keyboard Maestro and can keep playing with tweaks until we find the mix that is right for our intended use.