Closing ftp-session with synchronize command, batch file

Advertisement

scourge-
Joined:
Posts:
1

Closing ftp-session with synchronize command, batch file

Hello,

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\WinSCP.com" ^
  /log="D:\Transferlog\WinSCP.log" /ini="nul" ^ /script="UploadScript.txt" ^ /keepuptodate D:\RCL-510A /Elements_1Tb/kamera
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
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\*"
exit

Reply with quote

Advertisement

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

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.

Reply with quote

Guest

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.

Reply with quote

Advertisement

You can post new topics in this forum