# Julia as a bridge between windows and raspberry pi

**URL:** https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748
**Category:** General Usage
**Created:** [June 1, 2023, 11:40pm UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748 "2023-06-01T23:40:51Z")
**Posts on this page:** 15
**Page:** 2

<div class="post-metadata">

### Author: ![RDuarte](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@RDuarte](https://discourse.julialang.org/u/RDuarte)
#### Post date: [June 5, 2023, 11:05pm UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/21 "2023-06-05T23:05:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![djvanderlaan](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@djvanderlaan](https://discourse.julialang.org/u/djvanderlaan)
#### Post date: [June 6, 2023, 6:49am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/22 "2023-06-06T06:49:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [June 6, 2023, 8:44am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/23 "2023-06-06T08:44:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![RDuarte](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@RDuarte](https://discourse.julialang.org/u/RDuarte)
#### Post date: [June 6, 2023, 8:59am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/25 "2023-06-06T08:59:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [June 6, 2023, 9:03am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/26 "2023-06-06T09:03:30Z")

</div>

There is a lot of information in the answers to [how-to-copy-files-from-one-machine-to-another-using-ssh](https://unix.stackexchange.com/questions/106480/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](https://www.openssh.com/txt/release-8.0) on April 17th, 2019."

[This](https://lwn.net/Articles/835962/) 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](https://www.linuxjournal.com/article/8904).

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

> [@mkitti](#):
>
> The key command line tool to use is either `sftp` or `scp`. I recommend `scp`.

Why do you recommend `scp`?

EDIT:  
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](https://man7.org/linux/man-pages/man1/sftp.1.html) or [rsync](https://man7.org/linux/man-pages/man1/rsync.1.html).

> 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](https://www.openssh.com/), and was suprised to see that they still feature `scp`, despite OpenSSH supposedly depricateding it in 2019.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/8/18c34b4ebccec3456dc5c66f5bbb0b81ac75feb6.png)  
Clicking the link for `scp` tkes you to a documentation page, which reveals that  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/b/cbd8379b34137b62eeb24e94684a00279130c3c9.png)  
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.

---

<div class="post-metadata">

### Author: ![RDuarte](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@RDuarte](https://discourse.julialang.org/u/RDuarte)
#### Post date: [June 6, 2023, 9:16am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/27 "2023-06-06T09:16:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [June 6, 2023, 10:31am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/28 "2023-06-06T10:31:23Z")

</div>

A little more detail in the following two blogposts:

- [How to Upload Files to Remote System Over SSH](https://linuxhandbook.com/transfer-files-ssh/)
- [https://www.simplified.guide/ssh/copy-file](https://www.simplified.guide/ssh/copy-file)

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.

EDIT:  
It seems like `scp` is updated to use `sfpt`, based on the OpenSSH [docs for `scp`](https://man.openbsd.org/scp.1). 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.

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [June 6, 2023, 10:52am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/29 "2023-06-06T10:52:58Z")

</div>

> [@djvanderlaan](#):
>
> I would first try do debug this outside of julia

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.

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [June 6, 2023, 10:56am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/30 "2023-06-06T10:56:16Z")

</div>

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](https://winscp.net/eng/docs/script_local_move_after_successful_upload)

---

<div class="post-metadata">

### Author: ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)
#### Post date: [June 6, 2023, 11:28am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/31 "2023-06-06T11:28:30Z")

</div>

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,

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [June 6, 2023, 3:31pm UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/32 "2023-06-06T15:31:52Z")

</div>

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?

```julia
isdir(raw"C:\User")
readdir(raw"C:\User")

isdir(raw"C:\User\R_Dua")
readdir(raw"C:\User\R_Dua")

isdir(raw"C:\User\R_Dua\Desktop")
readddir(raw"C:\User\R_Dua\Desktop")

```

Are you running `julia` under WSL2 or something?

---

<div class="post-metadata">

### Author: ![jdad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdad/32/4739_2.png) [@jdad](https://discourse.julialang.org/u/jdad)
#### Post date: [June 6, 2023, 4:53pm UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/33 "2023-06-06T16:53:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![RDuarte](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@RDuarte](https://discourse.julialang.org/u/RDuarte)
#### Post date: [June 6, 2023, 11:53pm UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/34 "2023-06-06T23:53:30Z")

</div>

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:  
 ![erro5](https://global.discourse-cdn.com/julialang/original/3X/f/3/f313f6c58922a5f729aa297562aba8cca3d0f100.jpeg)

I also tried:

 ![erro6](https://global.discourse-cdn.com/julialang/original/3X/b/6/b617abef522d709ff05803b877a2504afb4ed8c3.jpeg)

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

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [June 7, 2023, 3:31am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/35 "2023-06-07T03:31:47Z")

</div>

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.

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

```

Or

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

```

---

<div class="post-metadata">

### Author: ![RDuarte](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@RDuarte](https://discourse.julialang.org/u/RDuarte)
#### Post date: [June 7, 2023, 9:50am UTC](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748/36 "2023-06-07T09:50:04Z")

</div>

It worked.  
Thank you all.

[Previous page](https://discourse.julialang.org/t/julia-as-a-bridge-between-windows-and-raspberry-pi/99748.md?page=1)
