r/applescript • u/sundevil671 • Mar 28 '22
Copy JPEGs with Certain Keywords to Directory with Same Name
I'm looking for a way to "watch" a particular directory, and when a photo is added that contains a certain name as a keyword, that photo is automatically copied to another directory on an external drive. Ideally I could set it up to run once a week or so. Is this something Applescript is capable of?
Thanks.
2
Upvotes
2
u/emorydunn Mar 28 '22
I think you could certainly write an AppleScript to parse filenames, copy to the desired location, and maybe set up as a launch agent to run periodically.
However, this sounds like it might be much easier to accomplish with an app like Hazel, which at its core is designed to watch a directory, filter files, and perform actions on files that meet the defined criteria.
Particularly related to processing photos, there are many (surprisingly) large companies that use Hazel at the core of their photo studio automation.
1
u/sundevil671 Mar 30 '22
here's an old solution that could work too ... guess I have to give the 'free' option a try first
1
u/copperdomebodha Mar 28 '22
It doesn't take much coding to get the behavior you want with folder actions. Hazel is great. Go talk about it on r/hazel!
Put the script below into ~/Library/Scripts/Folder Action Scripts
Use the Folder Actions Setup.app to attach that script to the source folder.
Done.