9

Nemo displays path to mtp device like that:

mtp://[usb:001,007]/

I want to be able to copy path from Nemo to terminal and cd there. Maybe it's possible even with this path while escaping some symbols (tried unsuccessfully)? Currently I have to do it this way:

cd /run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C007%5D
0

1 Answer 1

5

To be usable as a path you have to URL-encode the string that you get from Nemo.

To do so the following oneliner should return the command to use to cd into your mtp device:

echo -n mtp://[usb:001,007] | python -c "import sys,urllib; \
print 'cd /run/user/1000/gvfs/mtp:host='+urllib.quote(sys.stdin.readline().replace('mtp://',''))"

it returns:

cd /run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C007%5D
1
  • I'm sorry for not commenting earlier. I've just found your answer not helpful for me (it makes copying easier but not enough for everyday use), but it's also well-researched and I think it's likely helpful for someone else. That's why I've neither accepted/upvoted/downvoted. Also from my point of view my question now looks more like a feature request for Nemo developers, so I'm not even sure if it's legit here (at least it's not a bug report :).
    – janot
    Mar 30, 2015 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .