Need help making a scheduled automated script

Advertisement

TemporaryName
Guest

Need help making a scheduled automated script

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
cls

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@127.0.0.1" "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@127.0.0.1" "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).

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Need help making a scheduled automated script

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?

Reply with quote

Advertisement

You can post new topics in this forum