nakabonne / pbgopy

Copy and paste between devices
MIT License
813 stars 30 forks source link

Add support for file copying #22

Open xsteve opened 3 years ago

xsteve commented 3 years ago

It would be really cool if pbgopy could also be used to transfer a single file. Since there is already a clipboard server, this server could do that as well.

My use case is, that I work on two computers and I want to transfer either clipboard data or a file.

It could work as follows: host1# pbgopy serve file1 file2 file3 host2# pbgopy download

Not sure if it fits your vision of the tool, but it could be really useful since I don't have to enter the file name on file reception and I could send more than one file

nakabonne commented 3 years ago

Thank you for your proposal. That sounds good, but I want to keep this tool as simple as possible.

You can instead transfer multiple files by compressing.

tar -zcvf dir1.tar.gz dir1
pbgopy copy <dir1.tar.gz

Then paste on another device.

pbgopy paste >dir1.tar.gz
tar -zxvf dir1.tar.gz
PaluMacil commented 3 years ago

I understand the response, and I don't know if I disagree, but there are sadly many of us that (despite using Linux for over a decade) still can't remember the flags for tar. It's a good solution though.

nakabonne commented 3 years ago

Sure, I also still can't remember the tar's flags :D Then I recommend using piping-server to transfer multiple files. You can do that with:

Host1

cat file1 | curl -T - https://ppng.io/file1
cat file2 | curl -T - https://ppng.io/file2

Host2

curl https://ppng.io/file1 > file1
curl https://ppng.io/file2 > file2

Though you eventually have to enter the file name 😅