Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to sync between a folder and usb drive, so that

a) when I plug in a particular usb drive, a script runs to copy any newer files from the usb to the folder; and

b) when I unmount the drive (click eject in nautilus), a script runs to copy any newer files from the folder to the usb.

I am confident that I can use udev and rsync to accomplish part a), but how can I achieve part b)?

share|improve this question
possible duplicate of Autorun a script after I plugged or unplugged an USB device –  Radu Rădeanu Aug 14 '13 at 15:03
@radu I dont like the answer given >:-D With the upstart it is probably possible too: you can create events on creation and deletion of files (and an umount removes a directory :) ) If I got time Ill add it to that one ;) –  Rinzwind Aug 14 '13 at 15:07
@Rinzwind I don't like as well, but what can I do... The question is the same. –  Radu Rădeanu Aug 14 '13 at 15:13
It's similar, but I'm not sure that it's the same. I'm looking to run a script when a particular usb is ejected. The other question is dealing with plugging and unplugging in general. –  rudivonstaden Aug 14 '13 at 16:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.