How to check if a file exist using sftp in Remote server using R.
Out of 5 files, 2 are missing in the server. hence it reads first two files and then throw the following error:
Error in function (type, msg, asError = TRUE) :
Could not open remote file for reading: No such file or directory
The program breaks as the error is obtained and does not read the three available files.
library("RCurl")
protocol <- "sftp"
server <- "data.google.com"
userpwd <- "xyz:xyz123"
fileName <- "abc.csv"
url <- paste0(protocol, "://", server, "/", fileName)
data <- getURL(url = url, userpwd = userpwd)