Sitemap
Mac O’Clock

The best stories for Apple owners and enthusiasts

Follow publication

How to organize screen captures taken in macOS to a monthly or daily directory automatically

3 min readMar 9, 2020

--

Today, I will tell you about how to organize screen captures taken in macOS to a monthly or daily directory automatically.

When I take a screen capture in macOS, the image file will be saved in a specific directory (default: /Users/your_name/Desktop). If you take a lot of screen captures over a long period of time, the large number of image files saved in that directory. It will make it difficult to find the image file you want.

To solve that problem, I introduce a way to automatically save screen captures in a monthly or daily directory.

About my solution

In macOS, the screen capture will be saved with a filename having a date and time like sc 2020-03-07_15.36.39.png. So I will organize the screen captures using their filename. In this way, they will be organized like the following directory structure.

$ tree .
/your/path/
└── 2020
├── 01
│ ├── sc__2020-01-01_132830.png
│ └── sc__2020-01-22_222346.png
├── 02
│ ├── sc__2020-02-11_163716.png
│ ├── sc__2020-02-16_140132.png
│ ├── sc__2020-02-16_190945.png
│ ├── sc__2020-02-16_191009.png
│ ├── sc__2020-02-16_191703.png
│ ├── sc__2020-02-16_192223.png
│ ├── sc__2020-02-22_131052.png
│ └── sc__2020-02-22_134907.png
└── 03
├── sc__2020-03-01_101256.png
├── sc__2020-03-01_195937.png
├── sc__2020-03-01_200003.png
├── sc__2020-03-01_200033.png
├── sc__2020-03-01_214710.png
├── sc__2020-03-03_183331.png
├── sc__2020-03-03_183737.png
├── sc__2020-03-05_213054.png
├── sc__2020-03-05_213957.png
├── sc__2020-03-07_130956.png
├── sc__2020-03-07_151354.png
├── sc__2020-03-07_151433.png
├── sc__2020-03-07_151650.png
├── sc__2020-03-07_151715.png
├── sc__2020-03-07_151746.png
├── sc__2020-03-07_151749.png
├── sc__2020-03-07_152524.png
├── sc__2020-03-07_152639.png
├── sc__2020-03-07_153639.png
└── sc__2020-03-07_153639_2.png

How to that?

There are two steps in my solution. I will tell you about each step.

Step1: Create a script to organize screen captures (Python 3.x)

In the first step, create a script that organizes screen captures in a monthly or daily directory. Now I introduce the script runs at Python 3.x.

Save this script to any directory in your local machine. And replace the following values to match your environment.

SC_DIR: This is a path to the directory where screen captures are saved.
SC_OUT_DIR: This is a path to the directory where organized screen captures are saved.
DIR_TYPE: This is a switch to way to organize. If you use MONTH screen captures will be organized in a monthly directory, or if you use DAY they will be organized in a daily one.

This script also renames the file name of screen captures like following.

  • replace half-space to underscore
  • remove period
  • remove brackets (that used when the captures are taken at multi-display)

Step 2: create Automator workflow

In the second step, create a workflow in Automator.

The kind of workflow is Folder Action. Please specify the directory where screen captures are saved. This directory is the same as the value of SC_DIR .

The first action is Executing Shell Script. Please specify the following command.

python3 /your/path/to/script/organize_mac_screen_captures.py

The second (the last) action is Notification. This is optional action but if you set this action, you can immediately notice that the screen capture has been organized.

--

--

Mac O’Clock
Mac O’Clock

Published in Mac O’Clock

The best stories for Apple owners and enthusiasts

Yoshihiro ITO
Yoshihiro ITO

Written by Yoshihiro ITO

Japanese server-side engineer. My blog in Japanese: https://michimani.net

No responses yet