Reputation: 451
I know I can trigger actions when a specific file is added to a folder, but I like to do the same when a file is renamed, e.g. remotely (Dropbox, etc) How can I do that? Thanks
Upvotes: 1
Views: 285
Reputation: 207405
Updated Answer
Here is a little script that will fire Applescript to display a dialog box every time any file changes in your current directory:
#!/bin/bash
fswatch -x . | while read f; do
osascript <<EOF
tell application "System Events" to display dialog "$f"
EOF
done
So, you would save it as monitor
, then make it executable (only necessary once) with:
chmod +x monitor
and run it with:
./monitor
You will see that it fires Applescript each time with the name of any files that change in your directory.
Original Answer
You can maybe use fswatch
. I install it with homebrew, using:
brew install fswatch
Then you can run fswatch
on your Dropbox account like this:
fswatch -x -r ~/Dropbox
and it will print a line each time anything happens in your Dropbox and you can pass that to a script for processing.
Here are a couple of examples:
and
Upvotes: 1