Ask HN: How to easily transfer files between devices

24 points by billconan ↗ HN
I own one linux and one mac computer, and also one iphone. I found transferring files between them is not convenient.

Airdrop is nice, but is not available for the linux machine. I have been using scp between the mac and the linux.

And if I need to transfer something to my phone, I will have to scp to my mac first, then airdrop.

webrtc based anonymous services like

https://file.pizza/

https://www.sharedrop.io/

are not ideal either. mainly they expect people to type very long urls or share urls with a message app. But in many cases, I need to share files with random people, I don't know how to exchange the long urls.

I want to make something better to solve this problem (as a side project). I have been having the itch for doing it for long. But every time I consult my friends about this idea, they don't seem to feel the pain that much.

Is this worth my time solving? Or I just missed some already existed solutions?

43 comments

[ 3.3 ms ] story [ 83.2 ms ] thread
Instead of `scp` you can use `rsync`. iOS13 supports SMB via the file manager, you can set up SMB on the Linux machine and access your files on both the Mac and the iPhone via SMB.
I think I'm not understanding how you would access files on an iphone via SMB.
I think that should be possible with the files app or something like Transmit
In the Files app, click on the “...” button in the top right. Then choose “Connect to Server”.
The usability difference between a platform-agnostic AirDrop, and Dropbox, just isn’t big enough imo. Most people are happy enough with Dropbox or Drive.

I mean, I wish something like this existed, but I just don’t think there’s enough real need

(comment deleted)
Could you make something like the old Windows Personal Server [1], but dummy-proof? Make the app a DYNDNS client and let them register subdomains on your short domain (mybox.foo.bar/file.png). Essentially just a very simple server like XAMPP that users can drop their files into.

[1] http://www.windowsnetworking.com/j_helmig/w98pws.htm

I'm working on this problem now. I'm still building the lower layers, which are:

- An RPC mechanism (not built yet)

- A bi-directional multiplexing stream protocol [1] (mostly there)

- A general purpose binary encoding mechanism [2] (I've gotten bogged down with this for the past few months, but I can finally see the light at the end of the tunnel!)

The idea is to get these lower layers finished so that I can build all of my data communications related projects on top of them. One of those is a general-purpose file access system that I can build actual products on top of, such as file managers, remote filesystems, streaming services, synchronization, etc. I'm rebuilding everything underneath because the existing protocols are too chatty and bloated, not modular enough, don't work with encryption, or have weird requirements (like NFS requiring kernel integration for example, or they're restricted to the local net, etc).

[1] https://github.com/kstenerud/streamux/blob/master/streamux-s...

[2] https://github.com/kstenerud/concise-encoding

Impressive effort. I’m sure you looked at it, so I’m curious why not use gRPC? To avoid HTTP?
I've looked at all of the protocols out there, and the short reason list is one or more of:

* they're too chatty.

* They waste too much on overhead.

* their bidirectional support is poor.

* Their asynchronous support is poor.

* They can't multiplex across multiple connections.

Existing solutions that cover this are services like Onedrive, Dropbox & Co. Copy things into one folder one a device and it will show up on all other devices. Either directly downloaded, or easily be available for download.

with a couple of clicks you can also share the things via URL with someone else.

Agreed. Unless you're moving around huge files, dropbox does this very well. Run the client on your linux and mac boxes and install the app on your iphone. Files are backed up to the cloud and available on all devices. All my txt notes, photos, and other files I care about are on dropbox and available on any device I want them to be.

And it's easy to share out individual files or folders from dropbox so others can access them.

I use syncthing, but I don't think there is an ios client.
It's worth it! Even tough it's been worked upon forever; Dropbox. Napster, Emule, FTP, Kazaa, MIME, zmodem. I've never connected the dots between these two comics but they are published just some months a part. Basically this is a social problem not a technical one.

https://xkcd.com/949/ https://xkcd.com/927/

(comment deleted)
> And if I need to transfer something to my phone, I will have to scp to my mac first, then airdrop.

Aren't there scp/rsync clients for iPhone?

Between Mac and Linux, I use "python -m http.server". Specifically, I go to the source folder, run the python simple HTTP server. Then in the destination computer or iPhone, I browse the source folder.

If you want to get extra fancy, you can use an alias in .bashrc to shorten the "python -m http.server" to something you prefer.

I use the Mac apps to transfer from iphone to Mac.

Here's how I'd love this process to work:

Let's assume that the service is called "Throwbox", and you have an account with username `you@foo.com`, and the person you want to send a file to has username `them@bar.com`:

- You have a folder on your computer called "Throwbox"

- Inside that folder you create a folder called "them@bar.com" (so /Throwbox/them@bar.com)

- You put a file inside that folder.

- They create a folder inside their Throwbox directory called "you@foo.com" (so /Throwbox/you@foo.com)

- The file that you put in the folder on your machine gets copied onto the folder they created on their machine.

That way you don't need any information from them other than their username, and you can't send files to people who don't want to receive them. If you don't want to get files from another person anymore, then just delete the directory with their email address. And sending files is 2 way; if you want to send them a file back, just put it in the same place.

This is pretty much* how the Keybase filesystem works, with the added benefit of using more identities than just emails/usernames. Even if you only know someone's Twitter handle or reddit account, you can have this same workflow.

*Except for the "unless they don't want to receive files from you" part.

All of the cloud drives solve this issue.

If you just want something simple for personal use, I'd look into the iOS Shortcuts app. Shortcuts can send files that were shared to it via HTTP or SSH (as STDIN to a shell command), and it can store files on your phone. You could use QR codes to exchange URIs, IP addresses or file paths.

For example, to send from Linux to iOS:

  - Linux machine serves file over HTTP, displays a QR code with the URL
  - You scan QR code and download the file
For iOS -> Linux:

  - Linux machine displays QR code with its IP address
  - On your phone, you share the file with a shortcut
  - The shortcut scans the QR code, then connects to the machine via SSH.
  It runs an application on your Linux machine (e.g. cat > /tmp/file-from-ios)
  and passes the file in as input.
Why can’t there just be one simple solution for this which is peer-to-peer? Why does it have to depend on the cloud?

Because in order to be simple, any solution requires the skilled time and attention of an engineer to create an abstraction layer over the fiddly details. And to update that as the device takes updates.

If you do it as a peer-to-peer tool, that effort is O(N^2). Adding Each new platform requires ensuring that it works with N other platforms you already support.

If you introduce some intermediary like a cloud server, then the problem is O(N). When you add a new platform, just make sure it works to talk between the server and that 1 type of client.

But why does the intermediary have to be a whole server? Why can’t it be a protocol or format? <% insert explanation from someone more knowledgeable about filesystems %>

Why can’t there just be one simple solution for this which is peer-to-peer? Why does it have to depend on the cloud?

Peer to peer solutions are more difficult to build because there are more problems to solve:

* Peers need to be in the same network (same Wifi, Internet, etc.). If they are not, a connection needs to be established in some way.

* Peers need to know how to reach each other. How can they exchange addresses?

* Network/OS needs to allow exchanging messages (NAT, firewalls, proxies, ...). If they can't, then what?

All of these are complicated and have lots of error cases.

Cloud-based solutions make some assumptions to simplify the problem space: peers have a working internet connection, they can use DNS to look up addresses, and can reach a centralized server, usually via HTTP. It's even better if they are browser based, then peers don't need to install a new client.

As Bluetooth and Airdrop show, things don't always need to be cloud based. But also, as Bluetooth shows, it's really difficult to make it work seamless.

I'm using the "stupid" method of emailing stuff to myself. Works for pictures I'm taking with my phone and I also don't have to spend too many neurons doing so.
AirDrop is supposedly based on the OWL protocol, and is possible to use under Linux. Never tested it myself..

https://owlink.org/

usb drive
This migth've been tongue-in-cheek but seriously, this is what I do a lot of the time. I have a usb drive specifically to quickly move files around with a dual USB type A and micro-usb interface, specifically to move files from my phone. Less thinking / worrying/ debugging "why-didn't-that-work".
I use kdeconnect extensively and it's by far the best solution I have seen. Not only does it allow for sending files but you can even browse the storage on your phone from your computer wirelessly, plus it does notifications syncing, remote commands and a whole lot more. It's actually available now for linux as well as mac and windows and runs great.
+1 for KDE Connect. Really feels like living in the future (that is, the future that should have arrived 10 years ago).

The really cool thing is it's peer-to-peer - if you have multiple desktops running KDE Connect, they can all send files to each other!

Not great for sharing files with "random people" though.

‘python3 -m http.server’ is useful in many occasions
I use an app named "Handshaker" between Android and Mac. Its works pretty well.
For sharing files between your own devices, AirDroid [1] would be the simplest one to use. It’s also accessible on web.airdroid.com so you can drop files on to the website and send to or receive from other devices.

For sharing with random people, if you can’t send long URLs (through messages or even through a QR code), then you probably can’t ask them to install an app or visit a website I suppose.

[1]: https://airdroid.com