#Apple folks, what is the best way to monitor a folder under #macOS and invoke a shell script/command when new files are added?

I want to have a PDF-inbox, which gets OCRt whenever I add a new file. Currently my NAS does this via cronjob and I need a better solution.

#Automator ? #FSWatch ?

Update:
The automator workflow I tried before postings works.
The solution with shortcuts works.
The solution with hazel works.

Now it is up to me to decide, which approach is the most decent one.

@dalcacer I know this is way bigger than what you are searching for, but in case you don’t find anything lightweight: I have paperless-ngx running on my NAS for this exact usecase

@javahippie thx. I've actually been trying paperless-ngx before.

It doesn't suite me. A simple folderstructure and some nameing foo (`YYYY-mm-dd_#Type-Stuf.pdf`) is best for me.

@dalcacer I suggest to look for "folder actions" for this purpose. They can trigger AppleScripts or Automator actions.

Since #macos #tahoe folder actions can also trigger shortcuts, like described here: https://sixcolors.com/post/2025/08/get-started-with-folder-automation-in-macos-tahoe/

Get started with folder automation in macOS Tahoe

Setting up a folder Automation in macOS Tahoe. One of the most exciting additions in macOS Tahoe is Shortcuts automation, which (among many other things) allows Shortcuts to act when things move or…

Six Colors

@maddin tried something in that direction, and wasn't really getting the hangs of it.

Maybe that article will guide me in the right direction. Thanks!

@dalcacer Hazel app

@ctietze I have hazel setup for tagging and sorting.

Does it run commands aswell?

Edit: it can 🤩