I am working on a script that partially automates backing up contents of an MTP device. Before continuing, I am trying to verify that the relevant folders can be accessed, by adding a line that opens a folder in nemo. This is the script:


echo "mtp://[usb:[BUS],[DEVICE]]"
echo -n "Enter BUS: "
read BUS
echo -n "Enter DEVICE: "
nemo /run/user/1000/gvfs/mtp:host=%5Busb%3A$BUS%2C$DEVICE%5D/Internal%20shared%20storage/

The first "echo"-line is just for user reference.

$BUS and $DEVICE are correctly substituted with the entered values, resulting in the correct path for the root of the MTP device, but the following folder isn't interpreted correctly, as I get the following error message:

"Could not find "mtp://[usb:002,036]/Internal%2520shared%2520storage".

Please check the spelling and try again.


Where does the twice added "25" come from and how can I remedy this so the script opens the correct path in nemo?

  • isn't 25 hexadecimal ascii code for % ? I expect %20 turn to %2520 – Archemar Aug 6 '17 at 9:15
  • 2
    try quoting and use space. – Archemar Aug 6 '17 at 9:17
  • @Archemar Where should I place the quotes and the space? I am an absolute beginner when it comes to shell scripting. – user245225 Aug 6 '17 at 9:26
  • 1
    nemo "/run/user/1000/gvfs/mtp:host=%5Busb%3A$BUS%2C$DEVICE%5D/Internal shared storage/" – Archemar Aug 6 '17 at 9:41
  • 1
    @Archemar Edited comment, got ninja'd. Your suggestion works. Thank you! – user245225 Aug 6 '17 at 9:45

Archemar's suggestion of substituting %20 with a space and using double quote around the path string remedied my problem and results in the folder being opened correctly.