• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 840
  • Last Modified:

Secure FTP script automated

We are looking to upload a file daily using secure FTP. We have an account to log in and a directory in a remote sftp server. We are using Winscp. We could use any script if necesary. I am looking for a script to run daily and upload the content of a folder to a remote sftp server.


I am using win 2003 server
  • 2
1 Solution
winscp.net has an example file that I have modified:

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open user@example.com
# Change remote directory
cd /home/user
# Change local directory
lcd c:\data
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
put *
# Disconnect
# Exit WinSCP

Save this as your script, modify username, hostname and put the password if necessary. I would recommend using a keyfile, though.

You can start winscp by using this command line:

winscp /script filename

filename being the name of your script file.

You just need to put this in the scheduler to have it executed every day.
I am sorry, the command line is

winscp /script=filename

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now