Automatically transfer files to local folder from remote server using FileZilla or access SFTP server from R [duplicate] - r

This question already has answers here:
sftp get files with R [closed]
(1 answer)
Schedule weekly Excel file download to an unique name
(1 answer)
Closed 4 years ago.
My company´s data department uploads a .csv file daily to a remote folder that I can only access through my company's network using FileZilla.
Everyday, I use the newest .csv file and process the data in R. I want to automate this process. I want to access the daily .csv file by reading the .csv file from the remote folder using the read.csv function in R.
How can I tell FileZilla to copy the file in the shared folder to a local folder in my PC and do this everyday at 6:00 a.m.? If this isn't possible, how can I access the remote folder through R and read the .csvfile from there?
Thanks in advance!
EDIT:
As seen here, FileZilla does not allow any sort of automation. You can use the client WinSCP instead, write a script to download/upload files from/to a remote SFTP server and schedule the script to run every n days using Windows Task Scheduler.
Now, in order to access an SFTP server from R, you can use the RCrul package. Unfortunately, this closed question (which was closed because it was not even a question to begin with) purges unwanted lines of code from an FTPserver (even though the title says SFTP) and it doesn't specify the user, password nor port specs. Moreover, it uses the write.lines() command, which as I understand, is used to create, not download files.
This question specifically refers to downloading a .csv file from a shared folder using SFTP protocol. Given that FileZilla is no good for this, how can I manage to do this in R using RCurl?

Related

How to compare the content of local and remote directory via R

I would compare a local list of csv files with another remote list of csv file on online server. I would use R for this, how I can do ?
I'm alreday connect via R to the online server and now I would like to compare the local folder with the online without download the online

How to access remote file in GGIR package in R?

I a using GGIR package for accelerometer data analysis. My data is onedrive folder which takes a long time to download. Is there a way I can access the onedrive files directly without downloading to my local machine?
My guess would be that this is not possible. If you're working with Azure there are tools available to connect to OneDrive and download/upload the data which is then processed on a separate instance. I'm guessing the same applies to your local machine, but I'm not intimately familiar with Microsoft's services to be sure.
For example:
By using Azure Logic Apps and the OneDrive connector, you can create automated tasks and workflows to manage your files, including upload, get, delete files, and more. With OneDrive, you can perform these tasks:
Build your workflow by storing files in OneDrive, or update existing files in OneDrive.
Use triggers to start your workflow when a file is created or updated within your OneDrive.
Use actions to create a file, delete a file, and more. For example, when a new Office 365 email is received with an attachment (a trigger), create a new file in OneDrive (an action).
https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-onedrive

How to SSH files from a server and take those files (without downloading them) and code it so that they are uploaded to a website?

I have been given access to a bunch of files on a server and have been tasked with making it so that these files are put on some sort of website where people can visit it and access it. I have been able to SSH to the server using terminal commands and am able to view all of the files on the directory. I have tried using scp_download, however, that downloads all of the files on there which is extremely large and would ideally be avoided. Is there a way where I can take the files on the server and get them directly uploaded to a website using Shiny (R package)? If not, is there another way possible?
It looks like you already discovered the R package ssh. You could ssh::ssh_exec_internal() to execute a command on the server that uploads/copies the files to the website server. How you can do that depends on the type of access you have to the website server.
If you have ssh access to the website server as well, your command could look something like this:
ssh::ssh_exec_internal(ssh_session,
"scp file remote_username#website_server_ip:/directory")

Updating a CSV file once uploaded to private Shiny Server

Question is targeted at users experienced with shiny local server usage
My Shiny app uses a large csv file to read all its data from to prevent it from running a SQL command to get the same data everytime.
My question is once I have the app and all related files uploaded to my local shiny app server. Will I be able to locally write out from R to the csv file on my server (updating it with fresh data). Without having to re upload the shiny server app with the new data files?
Apologies if this isn't in everyone's most preferred way to ask questions around here but its just a simple question to find out if it can be done.

How to update MYSQL Database with data from Excel using ASP.NET?

I have an excel file which gets updated every 10 seconds through an automated process. I need excel data to be updated in MY-SQL database which is located on a remote server.
How do I do that?
I have thought of following option:
1) Every 11 seconds, an Excel macro will run and will "Save as" excel as CSV file. (not sure whether this can be done by macro...just thinking)
2) This CSV file we will FTP to remote server using Windows Service.
3) On remote server, we will parse the csv file and Update MYSQL database.
Is this approach fine? Or do you have a better approach which requires less time to update the database?
Thanks!
I found following links to be more useful:
http://www.heritage-tech.net/908/inserting-data-into-mysql-from-excel-using-vba/
http://vbaexcel.eu/vba-macro-code/update-mysql-database-php
I hope this helps someone having similar problem as mine.
You can connect to the Excel spreadsheet using ODBC connection, read the data, and post it to the MySQL database, maybe through some sort of web service access, or via a saved CSV file?

Resources