Linux flash drives

Solution 1:

I would recommend using udev.

Edit: Here's a similar question which was posted in 2007. http://www.linuxquestions.org/questions/linux-software-2/how-to-detect-programatically-if-a-usb-device-is-is-plugged-in-plugged-out-524568/

Solution 2:

In Ubuntu at least (meaning that the drive automounts), a drive's files can be found under /media/<drivelabel>. The drive label is either something random if you didn't set one or what you set it to.