Keyboard Maestro to trigger when lots of Dropbox files change

Hi there,
I was hoping to find a way for my home server Mac Mini, to email me if lots of files start being deleted from my Dropbox. The Mac Mini downloads my full Dropbox and runs Keyboard Maestro.

My need for this is a result of having a bunch of shared Dropbox folders. From time to time, other people who the files are shared with will accidentally delete lots of files or folders. I have lots of backup strategies, so the data is never really at risk, but it’s a pain doing lots of restores. Dropbox will email me if I delete a lot of files, but not if someone else who a folder is shared with does.

I know how to do the email bit of this equation, and I have found the Keyboard Maestro trigger for if a file is removed from a folder.
However, I’m not sure how to construct a KM macro that will only proceed to email me if the deleted files get over a certain number. I am at a bit of a loss as to what the next step might be. In fact, I’m not sure if it’s even possible.

Any suggestions for where to start, try or a different approach much appreciated.
Also, “I tried this and it only brings pain” also appreciated!

Thanks!

Have you considered Hazel?

One thought is a variable that keeps track of the number of deleted files in that folder and increments +1 each time a file is deleted. The same macro that is triggered by the deleted file could check the value of the variable and fire a notification/email when it exceeds a certain number. Then you’d need to work out when to reset the variable. You could easily do that with a periodic trigger, every x seconds/minutes, but that would depend on the traffic from Dropbox I guess. I think it’s doable.

One option would be to periodically run a script that counts the total number of files (eg find or ls -R will list all the files in the directory). Have Keyboard Maestro remember the last count in a variable and if the new count is substantially less than the old count, issue a warning. Keyboard Maestro could keep the output of the the find command as well so for bonus points you could diff the two to see the changes.

1 Like