I'd like to run a script (removing non-OSX .* files) on a USB drive whenever that drive is ejected - is there a way to trigger a script automatically when a drive is ejected from the Finder?
To clarify: I'm looking for a way of triggering a given script before the
umount command runs, i.e. immediately before the drive is ejected. I'm aiming to delete .* files and run
dot_clean before a FAT drive ejects, getting rid of OSX-only invisible files that confuse Windows systems.