Iwannabe Theguy
Iwannabe Theguy

Reputation: 149

Using package RCurl ftpUpload with @ symbol in the username

I have been using the RCurl package to pull data into memory from an SFTP and am trying to upload the transformed data into a different SFTP. The problem I am having is that the username assigned on the new SFTP has an @ sign in it. When I try to run the code below (sensitive info removed):

ftpUpload(what = file,
          to = "sftp://[email protected]:[email protected]/incoming/subfolder/data.csv")

The following error appears:

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to school.edu port 22: Timed out

The @ sign is creating an issue where the file is attempting to upload to the wrong location(school.edu as opposed to site.net). Unfortunately, I’m unable to alter the username as I’m told the site automatically generates usernames and will always use an @ sign. I really don’t know that much about SFTPs, so any help would be appreciated, even if that means working outside of R for a solution.

Upvotes: 0

Views: 371

Answers (1)

MrFlick
MrFlick

Reputation: 206566

Perhaps a safer way to pass the username and password is via the userpwd= parameter. For example

ftpUpload(what = file, 
  to = "sftp://site.net/incoming/subfolder/data.csv",
  userpwd="[email protected]:password")

Upvotes: 1

Related Questions