I am writing a script which should backup my Documents folder onto a USB stick. I want the script to be executed every time I connect the USB stick. I found a solution here. But it seems like I can't find the folder where to put the rule.
So does anyone know where I could find a udev or rules folder?
Best Answer
udev doesn't exist on OS X. As an alternative, you can use the
diskutil activity
command to continuously monitor disks being mounted or ejected. Thediskutil
man page saysWhilst running the above command and plugging in (then removing) my WD Elements USB drive, I get this output, which could be parsed (even though the man page says not to) to find, say,
DiskMountApproval
andDiskDisappeared
to get the volume name and when the disk was added and removed.