Julia as a bridge between windows and raspberry pi

Hello @mkitti
No, I checked, the path is correct.
Thank you

I suspect you have a space after the :. There should be no space.

It would be quite neat to have a package in the juliaberry org that facilitates file-transfer via SSH. It could assume both that there is a SSH connection, and that it is being run on a RPi, which should allow assuming that tools like scp and sftp are available.

Hello @TheLateKronos
I was searching but I didn’t find any.
If you know a package that allow to do that please let me know.
Thank you.

There is a lot of information in the answers to how-to-copy-files-from-one-machine-to-another-using-ssh.

The final answer states that " Many of the answers suggest scp, but it has since been deprecated in OpenSSH 8.0 on April 17th, 2019."

This article discusses replacements for scp. Personally, I am not sure what the best would be for your requirements, (callable from Julia on the server-side). Perhaps mounting a directory via SSH, as detailed in this guide.

Given that “the OpenSSH community considers scp deprecated”, I am curious about the following comment:

Why do you recommend scp?

It seems like scp uses sftp under the hood! The breadcrum trail for me was in the article that discusses replacements for scp. Some quotes from there:

Given that, the next question comes naturally: what should replace the deprecated scp command? The usual answer to that question is either sftp or rsync.

For all of these reasons, it would be nice to have a version of scp that doesn’t suffer from the current command’s problems. As it turns out, …

So I went to the openssh homepage, and was suprised to see that they still feature scp, despite OpenSSH supposedly depricateding it in 2019.

Clicking the link for scp tkes you to a documentation page, which reveals that
So all in all, it seems like scp has convenient syntax for non-interactive use, is part of OpenSSH (good maintainance and license), and comes preinstalled.

Hello @djvanderlaan
There is no space after, I double checked.
I was trying some alternatives and for example if I want to copy files between directories in raspberry it works perfectly with scp. However, when I changed the path to some windows directory where the file should be copied to, it doesn’t work.
I always get the same error message:

ssh: Could not resolve hostname c: Name or service not known
lost connection

I think the problem is the “C:” in the path. How to overcome this?
Thank you in advance.

A little more detail in the following two blogposts:

They essentally have the same content. The new information for this thread is that rsync seems to be a good alternative. The commands do not use echo and piping, which makes me feel like rsync is more obvious for non-interactive use, which it seems like you require.

It seems like scp is updated to use sfpt, based on the OpenSSH docs for scp. So use that for non-interacive use as well. rsync may be usabable, but scp is then sufficient. The blogposts are not updated to reflect this.

I second this. Quoting, spaces and interpolation can be cumbersome to debug.

I understand OP is already trying to get this working outside julia.
If this is working, one options is always to write a batch file (*.bat) which is then invoked by julia.

I have used WinSCP successfully for years now (windows client connecting to various host OS, mostly linux). You may want to look into some scripts like this One

You could try scp -p thefile localhost:c:thefile. The first : get recognized as host prefix, but the second is then considered part of the file path.

Hope this help,

If you cannot change to an existing directory from within Julia, then that is now a pure Julia issue. We should focus on that.

Could you try this sequence of commands?




Are you running julia under WSL2 or something?

Should it not be Users rather than User, as mentioned in the third post?

Dear all,
Thank you for your time and availability trying to help me in this desperate search.
I’m now able to copy a file between raspberrypi and windows using the following syntax:

scp rduarte@raspberrypi:~/newfileteste .

However, I would like to do this inside Julia.
If I type this line of code inside julia i get the following error:

I also tried:

Can you understand the where is the problem?
Thank you again

You put a single set if quotes around what should be two separate arguments, turning them into a single argument. You either need to drop the quotes or use two separate pairs of quotes.

run(`scp rduarte@raspberrypi:~/newfileteste .`)


run(`scp "rduarte@raspberrypi:~/newfileteste" "."`)

It worked.
Thank you all.

1 Like