2

I'm writing a bash script to synchronize pictures in my phone with my PC. What I need is to

  • detect if the phone is connected to a USB port
  • which port is used, and then
  • access it.

I'm not connecting my phone via USB tethering. The code that I already have it's this:

tmp=`gio mount -l -i | grep activation_root`
mount_point=${tmp//activation_root=/}
gio mount $mount_point
cp /run/user/1000/gvfs/*/*/DCIM/Camera/*.jpg ~/Test`

With this I'm getting the device and mounting it, but I've hardcoded the path used in the cp command. I need a way to obtain that path through a command or a way to use the command gio copy for this situation.

  • You may find https://unix.stackexchange.com/questions/315216/ubuntu-16-04-how-can-i-detect-a-device-independent-usb-insert-event/389353#389353 useful – K7AAY Apr 05 '19 at 17:06
  • 1
    Show us what you have, then show us which part you're currently having trouble with. Don't ask us to write the entire script for you. – Shadur Apr 06 '19 at 10:33

0 Answers0