Screenshot default filename without spaces - how to define?

Hi,

I have found many answers related to the change of the default screenshot file name under MacOS. However, when the screenshot is taken the date and time is added. The default format includes the spaces within the filename. For some applications it is easier to have '_' instead the space in the filename. How to set the default filename for the screenshot in format like 'screenshot_year_month_day_hout_minute_sec.png'?


I think that the best solution would be some system settings instead of using 'folder actions'? I'm not very familiar with 'folder actions' and Automator.

Best regards and thank you in advance for help.

B


Posted on Oct 30, 2022 1:27 AM

Reply
9 replies

Oct 30, 2022 7:10 AM in response to BOrysfromPoland

One can rename the Screen Shot in the Zsh shell in the following manner:


x="Screen Shot 2022-10-20 at 3.51.22 PM.JPG"
pat="-. "
mv "${x}" "${x:a:h}/$(sed -e "s/[${~pat}]/_/g" <<<${x:r}).${x:e}"
Result: Screen_Shot_2022_10_20_at_3_51_22_PM.JPG


Sed is being applied only to the basename of the Screen Shot using the pattern variable pat for characters to match and change to underscore. Then we tack the extension back on to it.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Screenshot default filename without spaces - how to define?

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