Secure FTP script automated

Posted on 2009-12-16
Last Modified: 2013-12-26
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
Question by:scubablue
    LVL 14

    Accepted Solution

    by: 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
    # Connect
    # 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.
    LVL 14

    Expert Comment

    I am sorry, the command line is

    winscp /script=filename

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now