MacOS – Altering screenshot filename

filesystemmac-minimacosscreen capture

When taking a screenshot using the keyboard shortcut shift+command+3 it yields a screenshot with a filename of Screen Shot 2014-11-23 at 3.25.36 PM.png. I would like to make a change so that the filename would be scr-20141123-152536.png. This would be the same exact date and time but altered to what I have been using for the past 13 years on other systems – it just works better for me. Is it possible to make this a permanent change? And, if so, how would I make this change?

UPDATE: I don't want to install Macports or Homebrew, or other package management system or apps that require the user to disable system security in order to run.

My system: Mac mini, late 2012, OS X 10.10.1 (Yosemite)

Best Answer

One approach that's forward compatible and will not get overwritten in an OSX update is to create a script that does ls -l Screen*.png (on the correct directory of course, I'm writing generically) if the list is empty the script exits, if not it uses mv to rename the file (and optionally move it if you also want to, you wouldn't need to since the renamed files won't match Screen*.png (the next time the script runs that is). I would look at using an xargs to pipe the ls to mv. (I'll admit this would take me a minute to cook up, but it's do-able.)

Once you have the script working correctly use cron on a one minute schedule (hint * * * * *). Since most of the time the script will exit after one command this will not use any measurable resources.

Previous answer:

One option would be to use fswatch to rename screenshot files as they are created. This option really has the most forward compatibility as well.

fswatch as the name implies allows you to WATCH for File System changes within a script, and then pipe the output to some other command. In this case probably xargs calling mv to change the name the way you want it to read.

I would reccomend this type of solution, as it is more update proof that modifying the way OSX names the file. (i.e. that is let OSX do it's thing, then just have a script that watches and renames immediately).