Changing the default screenshot filename

graphicsscreen captureuti

Is there a way to change the default screenshot filename prefix (the Cmd-Shift-4 type screenshot) to something other than the default? The default name looks like this:

Screen Shot 2011-08-30 at 10.01.36 AM.png

But I'd prefer to use something like:

screenshot_2011-08-30_100136.png

Basically so I can remove the spaces and junk, since it's annoying to browse dig through files in Terminal. Any easy way to change this prefix with one of the defaults write com.apple.screencapture style commands?

Best Answer

You can change 'Screen shot' to 'screenshot' with the following commands

defaults write com.apple.screencapture name screenshot
killall SystemUIServer

If you want to go digging a bit deeper in Terminal, you can achieve what you want by doing the following:

NOTE: Make a backup of any files you change in case you make a mistake.

  1. cd /System/Library/CoreServices/SystemUIServer.app/Contents/Resources/English.lproj
  2. Make a copy of the existing file:
    sudo cp ScreenCapture.strings ScreenCapture.strings.old
  3. Enter Admin password if prompted
  4. Convert to an editable format:
    sudo plutil -convert xml1 ScreenCapture.strings
  5. sudo vi ScreenCapture.strings

    Locate the following lines:

    <key>%@ %@ at %@</key>  
    <string>%@ %@ at %@</string>  
    

    and replace with the following lines:

    <key>%@ %@ at %@</key>  
    <string>%@_%@_%@</string>  
    
  6. Convert back to binary:
    sudo plutil -convert binary1 ScreenCapture.strings
  7. killall SystemUIServer

which combined with the first change should get you something like this:

screenshot_2011-08-30_10.01.36.png which is very close to what you need I think

Related Question