Created
May 27, 2022 01:43
-
-
Save pstoute/3a70ef24618c76e076fdd774412d19c1 to your computer and use it in GitHub Desktop.
PLIST to auto delete screenshots older than 60min and check every hour.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.my.delete.screenshots.every.hour</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>sh</string> | |
<string>-c</string> | |
<string>find ~/Pictures/Screenshots/Screen* -mmin +60 -exec mv {} ~/.Trash \;</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StartInterval</key> | |
<integer>3600</integer> | |
<key>KeepAlive</key> | |
<dict> | |
<key>PathState</key> | |
<dict> | |
<key>~/Pictures/Screenshots</key> | |
<true/> | |
</dict> | |
</dict> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tired of deleting all your screengrabs on your mac? Me too.
I wrote a plist file to automatically find any screenshots older than 60min and move them to the trash can automatically at the top of the hour or on wake.
To use this exact script, you'll need to do the following:
~/Library/LaunchAgents/com.my.delete.screenshots.every.hour.plist
launchctl load ~/Library/LaunchAgents/com.my.delete.screenshots.every.hour.plist
If you need to undo this automation for any reason you just need to unload the plist from launchctl via terminal:
launchctl unload ~/Library/LaunchAgents/com.my.delete.screenshots.every.hour.plist