Automatically Organize Your Screenshots on Mac with launchd
If you’re anything like me, you take a lot of screenshots for various purposes—be it work, personal projects, or just capturing something interesting on your screen. Over time, however, these screenshots can clutter your desktop or screenshots folder, making it hard to find what you need. I use Shottr, a fantastic screenshot tool for Mac (find them on Twitter), which makes taking screenshots a breeze. But, like many, I needed a solution to keep these screenshots organized without manually sorting them into folders.
Today, I’ll show you how to automate organizing your screenshots into folders by their creation dates using a simple script and launchd
, macOS’s built-in scheduler. This method is not only efficient but also runs quietly in the background, keeping your folders tidy with zero effort on your part.
Step 1: The Cleanup Script
First, we need to create a script that does the heavy lifting—moving screenshots into year-month formatted folders. Open your favorite text editor and save the following script as screenshots-cleanup.sh
in a convenient location (e.g., your home directory):
1 |
|
Make sure to replace "$HOME/Desktop/Screenshots"
with the path to your actual screenshots folder. If you’re using Shottr, you can configure its preferences to save screenshots to a specific folder.
Make the Script Executable
Run the following command in your terminal to make the script executable:
1 | chmod +x /path/to/screenshots-cleanup.sh |
Step 2: Setting Up launchd
Next, we’ll use launchd
to schedule this script to run automatically. Create a .plist
file named com.user.organizescreenshots.plist
in ~/Library/LaunchAgents
with the following content:
1 |
|
This configuration will run the cleanup script every Sunday at 10 AM. You can adjust the <integer>
values under <key>StartCalendarInterval</key>
to suit your preferred schedule.
Load the Launch Agent
To start the scheduled task, run this command:1
launchctl load ~/Library/LaunchAgents/com.user.organizescreenshots.plist
And that’s it! Your Mac will now automatically organize your screenshots into neatly labeled folders each week, making it easier to find and manage them.
Conclusion
With Shottr for capturing screenshots and this automated organizing system, maintaining a clutter-free screenshots folder has never been easier. This setup saves you time and keeps your digital workspace organized, allowing you to focus on more important tasks.
Feel free to share this guide with anyone who might find it useful, and happy organizing!