• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 847
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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