Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you transfer to a remote server where the file does not exist yet ? #7

Open
lowks opened this issue Aug 8, 2017 · 2 comments

Comments

@lowks
Copy link

lowks commented Aug 8, 2017

Do you have an example where I want to transfer to a remote system where the file does not exist and I do not want to over write any existing file but I want to create a new file ?

Example:

iex(13)> File.stream!("/Users/lowks/work/Radpath/LICENSE") |> Stream.into(SftpEx.stream!(conn, "/home/lowks/LICENSE")) |> Stream.run

13:11:11.334 [error] {:error, :no_such_file}

13:11:11.334 [error] {:error, :no_such_file}
** (BadFunctionError) expected a function, got: :no_such_file
    (elixir) lib/stream.ex:492: Stream.do_into/4
    (elixir) lib/stream.ex:591: Stream.run/1
@lorantkurthy
Copy link
Contributor

In my pull request #9 this is fixed.
As a workaround you can run this before streaming the file:

SftpEx.upload(conn,"/home/lowks/LICENSE","")

This will create an empty file on the remote host.

@janajri
Copy link

janajri commented Sep 11, 2017

Nice fix. Workaround worked perfectly for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants