Topic "Need help making a scheduled automated script"

Author Message


Hello everyone, I've been working on making an automated script for awhile now with WinSCP but I've encountered a few road blocks and seem to be stuck right now, I was hoping someone could help.

The goal of the script:
Connect to the sftp site A and download 5 text files every day at X time (say 10AM) these 5 files never have a different name, just updated contents. I need these 5 text files that I am downloading to be downloaded to a folder on my local computers network.

The problem:
I can't seem to get the "get" command to send the downloaded files to anywhere outside of the folder path that the files reside in (Site A). It seemed to me that the synchronize command could better replace the get command but I wasn't able to get a successful version of that to work either.

A working form of either or these would be extremely appreciated.

Here's a script I made as a local test that works (Connecting to a local server and saving the files locally with get):
@echo off
color 0b
title Automated File Transfer

REM This first line is used to take our current file and send it to our backup folder.

winscp.exe /console /command "option batch abort" "option confirm off" "open ftp://alice:abc123@" "cd /CurrentFilesOnly/" "get currentTest.txt C:\Users\alice\Desktop\Backup\oldTest.txt" "exit"

REM Next we use this final line to replace our current file with the newest released file.

winscp.exe /console /command "option batch abort" "option confirm off" "open ftp://alice:abc123@" "cd /NewFilesOnly/" "get newTest.txt C:\Users\alice\Desktop\CurrentFilesOnly\currentTest.txt" "exit"

Thanks in advance if anyone can help me figure out how to modify this for my goal usage or if someone can show me the proper way to use synchronize (I read the guides, but I just didn't seem to understand it the way it was put).
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Sorry, I do not understand what you are trying to do. Particularly, the part "to send the downloaded files to anywhere outside of the folder path that the files reside in (Site A)".

Don't you want to upload files (put command), rather than download them, in one of the two steps?
Martin Prikryl

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License