How can I determine the address of a pen drive in Linux?
My task is to create a file on my pen drive dynamically - as soon as I insert the pen drive, the file should be created.
|
How can I determine the address of a pen drive in Linux? My task is to create a file on my pen drive dynamically - as soon as I insert the pen drive, the file should be created. | ||||
|
feedback
|
|
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/ | |||
|
feedback
|
|
In Ubuntu at least (meaning that the drive automounts), a drive's files can be found under | |||||
feedback
|
|
+1 for the UDEV Create an UDEV rule that runs a script, whenever a device with a specific UUID is inserted. To determine the mountpoint of a device with e.g. uuid of "95738a33-589f-498d-8595-a81207f45dde", you can use the following ugly-but-working one-liner:
| |||
feedback
|