将文件从 Mac 同步到闪存驱动器 - 自动吗?

Som*_*DOS 5 ubuntu backup rsync macintosh

我有一个闪存驱动器,让我们命名它 FLASH

我想,当在我的 mac 上时,当FLASH插入(并自动安装)时,执行特定的脚本并使其~/Documents自动复制到/Volumes/FLASH/Documents(mac 将驱动器安装在/Volumes)。

同一个驱动器,,FLASHDocuments之前用mac情况添加了这个新文件夹),当插入Ubuntu机器时,我希望它自动复制FLASH/Documents~/Documents(或在安装后自动执行脚本)。

在这些不同的场景中,我应该如何做到这一点?我不想为此使用第三方应用程序,我更喜欢使用两个平台中都可用的核心/内置工具。

小智 1

使用钥匙launchd使用物品StartOnMount

# example launchd plist file using StartOnMount key
open -e /System/Library/LaunchDaemons/com.apple.backupd-attach.plist
Run Code Online (Sandbox Code Playgroud)

更多信息: