Hazel is what you want.
It's like Mail.app rules or Gmail filters, except for your files.
Here's an example rule that will do what you're looking for in the first set
It costs $25. It's worth that much and more. If you value your time at $5/hour this app will pay for itself and increase your satisfaction with your Mac usage.
It's basically a servant in app form. :-)
There's a 14-day free trial, and the developer is extremely responsive. Your money will go to help support a great Mac app that does something incredibly well. Actually, it does lots of things incredibly well.
(Note: I have absolutely no connection to this app or its developer except being a huge fan.)
Yes, you could write your own shell script or AppleScript to do this with launchd. I could do it faster than you could, because I've done it before. But I bought Hazel. Why? Because it's the best solution. And once you start using it, you will find so many different uses for it, you'll be glad to have it.
Seriously I can't use a Mac without this anymore.
What you can search for:
Here are the "attributes" you can search for:
("Kind" is thing like "image" or "document" or "folder".)
You can setup multiple criteria per folder, and you can set the precedence as to which rules run in which order.
What you can do for matching files:
Here are the actions that you can take on a file which matches those attributes:
Download the demo and start using it, and in two weeks I bet you won't want to give it up.
Here are some things that I do with Hazel:
When a new .zip arrives in my ~/Downloads/ folder, I automatically open it with The Unarchiver which unzips it to ~/Actions/Unzip/
Hazel looks in ~/Actions/Unzip/ for files which end with .app and if it finds any, it moves them to /Applications/
.pkg files? Hazel opens the Installer app
.dmg? Hazel mounts it
.pdf? Hazel moves it to ~/Dropbox/Documents/Downloads/ and then opens it
Image? Hazel moves it to ~/Dropbox/Photos/
New .amz file in ~/Downloads/? Hazel moves it to ~/Music/ and then runs clamz on the file
new PDF in ~/Actions/OCR/? Hazel opens it in ABBYY FineReader
New file in ~/Actions/ToAir/? Hazel will scp the file/folder to my MacBook Air from my iMac and then move the file to another folder when it is done. (Ditto on my MacBook Air if if put a file into ~/Actions/ToiMac/)
I have Drafts setup on my iOS devices setup to save snippets as text files in specific folders to trigger actions on my remote Macs. For example, any new text file in: ~/Dropbox/wget/ gets processed with
wget so I can download files from my iOS devices to my Dropbox.