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

martin

Re: Follow up questions, multiple folders and log files


  1. Yes. But if you want to synchronize all subfolders of V, you do not need to list them. Just synchronize the V.
  2. There's no option log. There's /log command-line switch:
    https://winscp.net/eng/docs/commandline#logging
    Also, in general, you cannot write to Program Files folder, unless you run WinSCP as administrator. You probably need to pick another folder for the log.
  3. There's no direct support for this in WinSCP scripting. So you need to use something like the PowerShell to start multiple WinSCP instances in parallel. Or use WinSCP .NET assembly. See the example here:
    Automating transfers or synchronization in parallel connections over SFTP/FTP protocol
  4. -filemask="*.rdata;*.sav"
    See https://winscp.net/eng/docs/file_mask
Apophis

Follow up questions, multiple folders and log files


  1. If I wanted to do more then one folder, I am guessing the code would be
    synchronize local "X:\Files\V\S" "/files/V/S" -criteria=time,size,checksum
    synchronize local "X:\Files\V\X" "/files/V/X" -criteria=time,size,checksum
    synchronize local "X:\Files\V\Y" "/files/V/Y" -criteria=time,size,checksum

  2. I also have this option log "C:\Program Files (x86)\WinSCP\LogFile\winscp_log.txt but I don't see a log file there. I want to make sure it worked but also I need to see how long it takes to do each folder.
  3. Would it be possible to run the different 'folders' as different scripts at the same time? Or do something like have PowerShell start them 2 hours apart to try and stagger them?
  4. If I only wanted certain files (.rData or .sav) I think the code would be this, -filemask="|*|*.rdata;*.sav"
    synchronize local "X:\Files\V\E" "/files/V/E" -criteria=time,size,checksum -filemask="|*|*.rdata;*.sav"

Apophis

Thank you for the help

Thank you for the help, I'll try the new code out tomorrow.
martin

Re: stuck on synchronize command, plus want to do more...

It looks mostly good. Except that there's no -neweronly switch to the synchronize command. If you want to synchronize only newer files, remove also -mirror, as that does the opposite (transfers even older files => all different files). Though that conflicts with checksum. So it looks like you actually do not want to synchronize only newer files, and you actually want the mirror mode.

Put your desired -criteria=time,size,checksum (no brackets, no spaces) on the same place, where -mirror -neweronly is.

Note that simple scripting does not support concurrent transfers. For that see:
Automating transfers or synchronization in parallel connections over SFTP/FTP protocol
Apophis

Stuck on synchronize command, plus want to do more...

So I (and ChatGTP) wrote this little script file but not sure if it is working, and I know it does not do everything I want yet. ChatGTP helped on it and I think it is wrong.
What I would like to do is for it to compare what I have on my local drive with what is on the site, if I do not have what is on the site, DL it. I'm only interested in DLing files, not uploading. Optimally I would like to check for criteria check so I think I need to add -criteria=<time, size, checksum> but not sure where. On the main app I have it set to 2 concurrent transfers, but if I change that, this changed. I would like for bat file run to stay that way with 2 concurrent transfers.

Also, any advantage to changing any of the other parameters? The files are going to be 20MB to 20GB.

Script file:
open Skyrem_Edu
option batch on
option confirm off
option log "C:\Program Files (x86)\WinSCP\LogFile\winscp_log.txt"
 
synchronize local "X:\Files\V\S" "/files/V/S" -mirror -neweronly
 
close
exit

Bat file:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="X:\Files\V\Educational\SFTP_Educational_sync_script.txt"