How to change the default screenshot name to not have spaces on mac?

JIRA made an update where they do not allow files to be attached to tickets that have spaces. The default screenshot name is saved as: "Screenshot 2024-04-30 at 2.27.45 PM.png" - how can we change the screenshot name to be automatically saved without the spaces or replaced the space with underscore "_"?


Without spaces: "Screenshot2024-04-30at2.27.45PM.png"

Replace spaces with underscore "_": "Screenshot_2024-04-30_at_2.27.45_PM.png"


I do not want to do this manually. I take several screenshots a day for work and I need it to save in a format that JIRA can read.


Thank you!

Posted on Apr 30, 2024 1:56 PM

Reply
2 replies

May 1, 2024 7:33 AM in response to xgrioux

There are a couple of issues with renaming Screen Shots with underscores.


  1. Immediately after the seconds number in the existing ScreenShot is a narrow no-break space (Unicode U+202F, UTF-8 e2 80 af). All other spaces in the ScreenShot name are regular spaces.
  2. After the rename, two things happen:
    1. The ScreenShot is no longer identified as a Screenshot by the operating system and its icon is made blank with the same result in Quick Look.
    2. Per [2.1], the Finder's Stacks no longer categorize it as a ScreenShot and it is shoved into the Other stack category when organizing by Kind.


Here is the Zsh shell code to rename a ScreenShot with underscores (including that narrow no-break space):


#!/bin/zsh

: <<"COMMENT"
Usage: ss_fix.zsh path/to/screenshot
COMMENT

# force absolute path, even on tilde paths
shot="${1:a:s/\~\//}"

# make *any* space in the name string an underscore
revised=$(/usr/bin/tr '[[:space:]]' '_' <<<"${shot}")
# print ${revised}
/bin/mv "${shot}" "${shot:h:r}/${revised:t}"
exit 0


Once you make this script executable, understand the caveats above before using it.



Apr 30, 2024 7:23 PM in response to xgrioux

  1. Launch the Terminal app (found in Applications/Utilities).
  2. Input the following command, and type your desired screenshot filename inside the double quote marks, then hit Enter: defaults write com.apple.screencapture name "Screenshot" then somehow chr(8) for backspace maybe?

https://www.macrumors.com/how-to/change-screenshot-filename-macos/

Naw, don't think it can be done...


Maybe make an ApplieScript & a watch folder?

How to change the default screenshot name to not have spaces on mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.