Copying files to an MTP device in the terminal

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read how to get help
Post Reply
iain_33
Level 2
Level 2
Posts: 70
Joined: Sat Dec 22, 2018 11:29 am
Location: UK

Copying files to an MTP device in the terminal

Post by iain_33 » Fri May 31, 2019 3:03 pm

I've just connected my Android phone to my laptop to copy some new music across. I can copy/paste folders through Caja, but I figured it would be simpler in the terminal with rsync (I don't have a music player / syncer set up on Mint, I don't play music from my laptop).

Straight away I ran into a problem - where's it mounted? It only connects as an MTP device, it doesn't have a mass storage mode. Caja's address bar showed mtp://%5Busb%3A002,004%5D/Card/Music. With a bit of googling, I found I could access it through the terminal at /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C004%5D/Card/Music.

I can read files from the SD card, but can't copy anything to it - I get cp: cannot create regular file '........': operation not supported. I tried touch foo to create a file but got the same error - touch: cannot touch 'foo': Operation not supported. Thinking it was permissions, I tried it with sudo, then got touch: cannot touch 'foo': Permission denied.

As I said, copying & pasting folders in Caja works fine, surely it can be done somehow in the terminal?
Linux Mint 19.1 MATE (64 bit) on a HP G70 laptop (circa 2008)
Intel Pentium Dual Core T3400 @ 2.16GHz -- 3GB RAM -- 1TB HDD
Intel Mobile 4 Series graphics -- Intel 82801I audio
Atheros AR242x/AR542x wireless network adapter

User avatar
Lord Boltar
Level 5
Level 5
Posts: 688
Joined: Mon Jan 09, 2017 7:24 pm
Location: Sunny Florida

Re: Copying files to an MTP device in the terminal

Post by Lord Boltar » Fri May 31, 2019 4:58 pm

Since it is and Android make sure you have the following files installed - open your Synaptic Package Manager and search for

go-mtpfs and jmtpfs if it is not installed install them

Now plug in your Android device using USB cable

From the Drop down menu on your Android device select "Conneted to USB in Charging Mode" then select "File Transfer" now you can transfer your files

hope this helps
IF your problem has been solved, please edit your original post and add [SOLVED] to the beginning of the Subject Line. It helps other members

The only way for evil to prosper is for good men to do nothing

iain_33
Level 2
Level 2
Posts: 70
Joined: Sat Dec 22, 2018 11:29 am
Location: UK

Re: Copying files to an MTP device in the terminal

Post by iain_33 » Sat Jun 01, 2019 7:46 am

Hi Lord Boltar, thanks for your reply.

I've installed go-mtpfs and jmtpfs, rebooted, connected my phone and made sure it's on file transfer mode, but it's still the same as before - operation not supported / permission denied.
Linux Mint 19.1 MATE (64 bit) on a HP G70 laptop (circa 2008)
Intel Pentium Dual Core T3400 @ 2.16GHz -- 3GB RAM -- 1TB HDD
Intel Mobile 4 Series graphics -- Intel 82801I audio
Atheros AR242x/AR542x wireless network adapter

Post Reply

Return to “Other topics”