Post a reply

Options
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)

Options

Topic review

jrp78

Ahh, sweet. it's working now. Thanks Martin!
martin

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
jrp78

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 :(
farnoise

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.
jrp78

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%