Sync Photos or Files over wifi Between Android and Linux with rsync and curlftpfs

I’ve had mixed success with transferring files between my Android phone and Linux computer. I’ve come to prefer using rsync for any file transfer; I grant that copying will often work, but the ease of double-checking that the transfer happened as planned, or of restarting it in the event of a failed transfer is worth a tiny bit of command line work for me. I’m assuming that you know how to install packages and know how to get a terminal.

Install an ftp server on your phone. I use File Manager HD. In File Manager HD, tap on ‘Tools’ at the top. Under File Transfer, click on ‘Transfer to PC.,’ than click ‘Start.’

Install rsync and curlftpfs on your computer.

Create a directory (“Phone” in this example; remember that Linux commands are case-sensitive.) on your computer and mount the phone storage there (Enter the IP address of your phone, displayed in File Manager HD.):

mkdir Phone
curlftpfs Phone/

Browse and drill down to your desired folder using cd, ls, etc. Don’t forget to tab for auto-complete and double-tab to see what your options are.

cd Phone

Use rsync to perform the sync. I use the -av options. See rsync manpage to help you. If you’re not familiar with rsync, make sure you understand the implications of omitting a trailing forward slash:

rsync -av /Phone/storage_0000-0000/DCIM/Camera/ ~/Pictures/2017-10-12/

After the transfer is finished, here’s the fun: up-arrow reruns the sync, and you can confirm with confidence the success of the transfer. There’s something strangely gratifying about seeing a ridiculously high speed-up (meaning the amount of time you saved over a straight re-copy):

sent 3,311 bytes received 12 bytes 2,215.33 bytes/sec
total size is 3,904,488,112 speedup is 1,174,988.90

Make sure to unmount the ftp directory before you quit (Otherwise, you may encounter nasty hangs when a command tries to look for the directory this mount points to):

fusermount -u Phone/

If you forget, this should get you out of the jam:

killall -9 curlftps


About anisly

This is Yet Another Tech Blog--my attempt at propagating some of what I've gleaned in trying to solve tech problems. YMMV, but enjoy
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Sync Photos or Files over wifi Between Android and Linux with rsync and curlftpfs

  1. Amazing! But you’ve some error: one f missed in “curlftps Phone/”
    I tried some other FTP-Server, found Wifi FTP Server, fewer ads. Thanks a lot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s