I have a Folder Action on a /Volumes folder. I'm checking when a specific disk is mounted (folder in /Volumes created), checking ssh to remote computer. If all present I run rsync there.
It was OK when number of files was low. Now only rsync's "building file list" takes 40 minutes. I want this action to ask before rsync for my decision. Better with osascript.
source="/Volumes/MyDisk/FolderToSync" user="username" host="myhost" port="22" path="/RemoteFolder/" log="$HOME/RSync_$(date +%Y.%m.%d_%H-%M-%S).log" rm $HOME/RSync_$(date -v-1m +%Y.%m.)*.log if [ -d "$source" ]; then nc -z $host $port > /dev/null if [ $? -eq 0 ]; then touch $log; osascript -e 'display notification "Do you want to RSync now?" with title "ssh"' rsync -czvaEP --delete --log-file=$log "$source" -e "ssh -p$port" $user@$host:$path; fi fi