I have a bash script running on my Mac that uses cURL to upload files to a remote Ubuntu server. I currently run the script on a 1 minute interval with a cronjob, and then append uploaded files with a “_uploaded” flag. I would love to avoid using the cronjob and just have a script “listen” to the directory and upload files only as they’re added. Is this possible, and if so, how would I go about this? Is there a better way to go about this?
Share
Just add a Folder Action. Right click on the directory in the Finder then associate a script with the folder. See e.g. http://www.simplehelp.net/2007/01/30/folder-actions-for-os-x-explained-with-real-world-examples/