5

I have a flash drive, let's name it FLASH.

I want, when on my mac, when FLASH is plugged (and automatically mounted), execute a specific script and make ~/Documents to be automatically copied to /Volumes/FLASH/Documents (mac mounts drives at /Volumes).

This same drive, FLASH, (with this new Documents folder added before with the mac situation), when plugged in an Ubuntu machine, I want it to automatically copy FLASH/Documents to ~/Documents (or automatically execute an script, after mounting).

How should I do this in these different scenarios? I don't want to use third party applications for this, I prefer using core/builtin tools available in both platforms.

0
1

Use a launchd item using the StartOnMount key!

# example launchd plist file using StartOnMount key
open -e /System/Library/LaunchDaemons/com.apple.backupd-attach.plist

Further information:

1
1

On the Mac, use Do Something When, a free software which triggers actions when you mount/unmount a drive.

On the Linux side, udev can run an external program when a disk is inserted (see e.g. How to be notified when a USB device was plugged in?).

1
  • I've update my question, I don't want to use third party applications. Thanks for the answer though. – Somebody still uses you MS-DOS May 13 '11 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.