Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Transfer Files between Android and Debian

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
pwzhangzz
Posts: 420
Joined: 2020-11-11 17:42
Has thanked: 9 times
Been thanked: 26 times

Transfer Files between Android and Debian

#1 Post by pwzhangzz »

For a long while I have been using the mtp protocol to transfer files between my android phones and my (Linux) desktop via a usb cable. Recently I realized that the file dates were not copied. After a brief search, found the following simple solution:

1. Install go-mtpfs from Debian repo;
2. Create a folder in the $HOME directory to store data to be transferred from android (in my case, MotoG);
3. Reboot (may not be necessary);
4. Open a terminal and execute the "go-mtpfs MotoG" command;
5. Open another terminal, go to the MotoG directory then run a "rsync -a" command with other appropriate parameters and arguments.


When done, make sure to umount the mtp drive:

fusermount -u MotoG

Thanks to the following excellent write-up:

https://askubuntu.com/questions/1339126 ... 93#1346893
Last edited by pwzhangzz on 2022-12-12 00:02, edited 1 time in total.

CwF
Global Moderator
Global Moderator
Posts: 2636
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Transfer Files between Android and Debian

#2 Post by CwF »

Why so complicated!

My GoFlip something appears as an icon on the desktop that actually looks like the phone!
Click it, it opens in Thunar. works fine. Often, I soft pass it to vm's, some not local. Works fine.
The usb device selection in virt-manager calls it an 'android android', and it's not even android. I should change that...

pwzhangzz
Posts: 420
Joined: 2020-11-11 17:42
Has thanked: 9 times
Been thanked: 26 times

Re: Transfer Files between Android and Debian

#3 Post by pwzhangzz »

Nautilus will do this without any additional effort. The problem was that sometimes dates (probably other file attributes too for example thumbnails) were not copied. The go-mtpfs app allows android system to be mounted on the pc thus allowing rsync operations via a usb cable. A 10+ GB folder takes less than 1 min. Plus I can use Nautilus' space and up-down cursor keys to preview the photo/pdf files. Pretty Neat.

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Transfer Files between Android and Debian

#4 Post by sunrat »

In KDE Plasma, Dolphin can mount phones and transfer easily. I usually use kdeconnect via wifi as it saves plugging in a cable. :lol: Sent files from phone appear in Downloads directory by default. kdeconnect is not limited to KDE despite its name.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

pwzhangzz
Posts: 420
Joined: 2020-11-11 17:42
Has thanked: 9 times
Been thanked: 26 times

Re: Transfer Files between Android and Debian

#5 Post by pwzhangzz »

Since I'm a big gnome fan (not the the gnome desktop itself which really sux but the gnome 4.3 extensions are what got me hooked), I have also previously used GSConnect (gnome version of KDEconnect) to do file transfers. I don't think I can cd to the mount point and run shell operations? ? ?

peer
Posts: 443
Joined: 2017-03-26 10:14
Has thanked: 8 times
Been thanked: 20 times

Re: Transfer Files between Android and Debian

#6 Post by peer »

on my pc: filezilla
on my android: ssh server
transfer over wifi with ssh.

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

Re: Transfer Files between Android and Debian

#7 Post by canci »

KDE Connect (which would be installed as a dependency anyway if you install GSConnect) does have a CLI interface called kdeconnect-cli.
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

pwzhangzz
Posts: 420
Joined: 2020-11-11 17:42
Has thanked: 9 times
Been thanked: 26 times

Re: Transfer Files between Android and Debian

#8 Post by pwzhangzz »

Me bad. The title should have been not just about file transfer but also about mount point. Understandably there must be at least a million ways to do the file transfer between a pc and an android.

Actually, most people find a need to clean their cell phone storage (which usually contains tens of gigabytes of photo images) only when (1) they change to a new phone or (2) their (free) Google cloud storage allocation is about to become full. Being able to cd to the directory in which the Android file system is mounted on the pc not only allows us to use appropriate Linux tool to do fast and complete file transfers, it also allows us to run bash/python etc operations on such a huge glob of data and impress the sh*t out of everyone watching. Linux rules! Debian rules!
Last edited by pwzhangzz on 2022-12-08 09:36, edited 1 time in total.

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: Transfer Files between Android and Debian

#9 Post by Hallvor »

sunrat wrote: 2022-12-08 02:09 In KDE Plasma, Dolphin can mount phones and transfer easily. I usually use kdeconnect via wifi as it saves plugging in a cable. :lol: Sent files from phone appear in Downloads directory by default. kdeconnect is not limited to KDE despite its name.
Indeed. kdeconnect is pure awesomeness. Transfer files wirelessly, Answer SMS messages on the computer, and if someone calls you the music or video on the computer stops automatically, and then resumes the moment you hang up. It can even help me find my phone when I have misplaced it at home.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
NFT5
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 597
Joined: 2014-10-10 11:38
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 43 times

Re: Transfer Files between Android and Debian

#10 Post by NFT5 »

Hallvor wrote: 2022-12-08 09:33 kdeconnect is pure awesomeness
Agree, and you can specify which folder the transferred files are copied to.

CwF
Global Moderator
Global Moderator
Posts: 2636
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 192 times

Re: Transfer Files between Android and Debian

#11 Post by CwF »

pwzhangzz wrote: 2022-12-08 09:20 Me bad. The title should have been not just about file transfer but also about mount point. Understandably there must be at least a million ways to do the file transfer between a pc and an android.
...snip... Linux rules! Debian rules!
No doubt!

So many ways! My flipper battery last for days and is data restricted so I use the cable to charge it, and load podcast and the like for the next week while tethered.

A while back I wanted to have limited tooled vm's (no sudo, no polkit) recognize a usb by name and mount it automatically using pmount. I forgot the outcome...

User avatar
oswaldkelso
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1490
Joined: 2005-07-26 23:20
Location: UK
Has thanked: 1 time
Been thanked: 58 times

Re: Transfer Files between Android and Debian

#12 Post by oswaldkelso »

peer wrote: 2022-12-08 08:25 on my pc: filezilla
on my android: ssh server
transfer over wifi with ssh.
This though I use https://ppareit.github.io/swiftp/ and midnight commander or gftp

Super simple to use and very reliable. Conversely I always found MTP to be very unreliable unnecessary.
Free Software Matters
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian

pwzhangzz
Posts: 420
Joined: 2020-11-11 17:42
Has thanked: 9 times
Been thanked: 26 times

Re: Transfer Files between Android and Debian

#13 Post by pwzhangzz »

Currently the mtp driver in sid has been upgraded to version 1.1.20. Look forward to Bookworm to acquire the stable status. Good point, although I think it is already pretty reliable in Bullseye.

Debian's go-mtpfs package allows us to "bootstrap" an android or iOS file system to the Linux kernel (i.e., "mounting") without installing any apps on the cell phone (mtp is already built in). But being able to go inside the mount point and run bash etc operations also allows us to showcase our computer prowess. Unlike most other Windows/Apple "experts". :D

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2082
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 225 times

Re: Transfer Files between Android and Debian

#14 Post by FreewheelinFrank »

Total Commander Send Via Wifi.

Files go in seconds.

User avatar
oswaldkelso
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1490
Joined: 2005-07-26 23:20
Location: UK
Has thanked: 1 time
Been thanked: 58 times

Re: Transfer Files between Android and Debian

#15 Post by oswaldkelso »

FreewheelinFrank wrote: 2022-12-09 21:08 Total Commander Send Via Wifi.

Files go in seconds.
Did you mean double commander ?
Free Software Matters
Ash init durbatulûk, ash init gimbatul,
Ash init thrakatulûk agh burzum-ishi krimpatul.
My oldest used PC: 1999 imac 333Mhz 256MB PPC abandoned by Debian

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2082
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 225 times

Re: Transfer Files between Android and Debian

#16 Post by FreewheelinFrank »

oswaldkelso wrote: 2022-12-10 10:51
FreewheelinFrank wrote: 2022-12-09 21:08 Total Commander Send Via Wifi.

Files go in seconds.
Did you mean double commander ?
No, definitely Total Commander. It has plugins for WiFi, Lan, Drive, OneDrive, WebDav... Free, no ads. It's the kipper's knickers

User avatar
ComputerBob
Posts: 1181
Joined: 2007-11-30 04:49
Location: The Mountains of the Sunshine State
Been thanked: 1 time

Re: Transfer Files between Android and Debian

#17 Post by ComputerBob »

Does Total Commander need to run in Wine?
ComputerBob - Making Geek-Speak Chic (TM)
ComputerBob.com - Nearly 6,000 Posts and 23 Million Views
My Massive Stroke
Help! (off-topic)
_________________
Your Life Matters

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2082
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 225 times

Re: Transfer Files between Android and Debian

#18 Post by FreewheelinFrank »

ComputerBob wrote: 2022-12-10 12:52 Does Total Commander need to run in Wine?
Total Commander is Android side. Send via wifi gives you a link to enter into a browser. There are download links for the files you want to share. TC must set up an http server. That's what I do if I want to copy several photos to the computer because it takes seconds where Bluetooth takes minutes.

I've never done computer to Android, and I couldn't find any Linux apps that do share by wifi, but setting up a temporary http server and entering the address in the wifi plugin in TC makes all files visible in TC to view, play or download.

Code: Select all

$ cd Downloads
~/Downloads$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Then enter x.x.x.x:8000 (computer IP address) into TC.

TC has a QR code reader to make setup even easier. I'm sure it would be possible to write a script to start an http server and flash up a QR code.

https://www.linux-magazine.com/Online/F ... s-in-Linux

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2082
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 225 times

Re: Transfer Files between Android and Debian

#19 Post by FreewheelinFrank »

Here is a script to use with Total Commander Receive via Wifi plugin.

Install qrencode and imagemagick packages.

Change IP address for that of your computer, save script as share.sh (or any other name) in home directory and make executable.

Make sure port 8000 is open (I'm assuming this is a local network behind a firewall).

Code: Select all

#!/bin/bash
python3 -m http.server &
qrencode -o qrcode.png 'http://192.168.2.16:8000/' &
display qrcode.png
Run

Code: Select all

$ ./share.sh
from user directory and scan the QR code that pops up with TC. Contents of home directory will then appear in TC to view, play or download. You can even navigate to sub directories.

Edit: here's a version that will find the IP address automatically:

Code: Select all

#!/bin/bash
ip=$(hostname -I)
echo http://${ip/ /}:8000/ > url.txt
python3 -m http.server &
qrencode -s 8 -r url.txt -o qrcode.png &
display qrcode.png
Edit 2: made the QR popup a sensible size with "-s 8" (width of code blocks in pixels).
Last edited by FreewheelinFrank on 2022-12-11 10:00, edited 2 times in total.

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Transfer Files between Android and Debian

#20 Post by sunrat »

KDEconnect context menu - send from desktop to phone (Realme 7 Pro):
sendtophone.png
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply