Synchronizing multiple unique folders in one ftps session possible?

Advertisement

jrp78
Joined:
Posts:
22
Location:
SoVA

Synchronizing multiple unique folders in one ftps session possible?

Is this type of thing doable or is my code just bad. It stops after the first synchronize command and justs shows "winscp>"

@echo off

SET TIMESTAMP=log_%DATE:~-4%_%DATE:~4,2%_%DATE:~7,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%.log

"D:\scripts\WinSCP-5.13-Portable\WinSCP.com" ^
   /log="D:\transfer_logs\%timestamp%" /loglevel=0 /ini=nul ^
  /command ^
    "open ftpes://user:pass@X.X.X.X:xx/ -certificate=""xx:xx:xx:xx:xx:xx:xx""" ^
   "option batch continue" ^
    "option transfer binary" ^
   "option synchdelete on" ^
   "synchronize local d:\inetpub\folder1\ /folder1/ -delete -criteria=either -filemask=""| thumbs.db; ~*.*""" ^ 
   "synchronize local d:\folder2\ /folder2/ -delete -criteria=either -filemask=""| thumbs.db; ~*.*""" EXIT


set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

farnoise
Joined:
Posts:
1
Location:
Canada

I had the same issue, the problem with SYNC is, it only watches for one folder, in an infinite loop style. so in your case, it's just waiting for changes in FOLDER_1, it never gets to go to next line.
One way to fix that is use PUT instead. and iterate over your folders, the way you did now. now the issue with PUT is, it won't really "sync" it puts newer files there, but if you del something, it won't del from remote.

Reply with quote

jrp78
Joined:
Posts:
22
Location:
SoVA

It appears setting up symbolic links for all my folders into one folder then syncing that folder works but I was hoping to avoid having to do that :(

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,731
Location:
Prague, Czechia

Re: Synchronizing multiple unique folders in one ftps session possible?

You have a space after the ^ at the end of the line with the first synchronize command. This effectively makes the ^ be ignored (it escapes the space, not the newline).
See https://winscp.net/eng/docs/faq_batch_file

Reply with quote

Advertisement

You can post new topics in this forum