Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


As I said, new to WinSCP + scripting.

The goal is to tun the batch once a week, with task scheduler.

Anyway, synchronize command will work too for sure.

Actually made some changes vedoten receiving this msg.
Still open to new ideas though.

Re: Closing ftp-session with synchronize command, batch file

Why are you using both keepuptodate and synchronize? If you want to perform one-time synchronization, use only synchronize and remove the keepuptodate.

Also remove the /keepuptodate command-line switch in any case. It's ignored and just confusing.

Closing ftp-session with synchronize command, batch file


I m new to this forum, and also quite new to use WinSCP with command line interface.

I recently installed PoE -camera, and I need an batch script to upload my files from my local folder to an router-ftp-server / usb drive.

I'm using batch script with scheduled windows task, to upload and synchronize my files from local folder to remote one.

My problem is that my BATCH script does not close / have TTL to close it after some time, and I didnt find solution from FAQ / Documentation.

Any ideas how to terminate the session, say after 5 minutes after upload?

The goal here is to run this script scheduled like once a week, upload the files and then exit.

Here's the script / scripts I m using. (They are still work in progress, so forgive me that they might have / lack some stuff.)

Upload script to execute with Task Scheduler
@echo off
"C:\Program Files (x86)\WinSCP\" ^
  /log="D:\Transferlog\WinSCP.log" /ini="nul" ^ /script="UploadScript.txt" ^ /keepuptodate D:\RCL-510A /Elements_1Tb/kamera
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error

Script file, containing the commands etc
open ftp://USER:PASSWORD@des.ti.nati.on.ip/ -timeout=360 # <-- does not help
keepuptodate D:\RCL-510A /Elements_1Tb/kamera
synchronize remote -preservetime "D:\RCL-510A "/Elements_1Tb/kamera" "
cd /Elements_1Tb/kamera
lcd D:\RCL-510A\
put "D:\RCL-510A\*"