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

techracer

Re: synchronizing with filemasks to exclude files

Thank you, Martin! Your reply was very quick and accurate. I tested the double quotes several times and it worked every time.

Thanks again!
martin

Re: synchronizing with filemasks to exclude files

You have to double the inner double-quotes:
"synchronize -filemask=""|thumbs.db"" remote -delete ""F:\TS MASTER DOCUMENTS"" /""TS MASTER DOCUMENTS""" ^

See https://winscp.net/eng/docs/commandline#syntax
techracer

synchronizing with filemasks to exclude files

I reviewed numerous posts and followed Site Admin Martin's advice but I cannot get the filemask to work to exclude files in the source tree when syncing. Here is what I added to my known-good script, and when this is added the script aborts with no visible error:
-filemask="|thumbs.db"

The script below shows what I am doing. This script works fine without that option. I placed z's in place of actual values to protect the confidential parts. I also tried
-filemask="|*.db"

in case you can't exclude a specific file, and also tried putting these strings before and after remote and nothing worked. I love WinSCP and would appreciate any help I can get because excluding files during a sync would be a really handy option to have.
"C:\1data\portableapps\WinSCP\WinSCPPortable\App\winscp\WinSCP.com" ^
  /log="C:\1data\portableapps\WinSCP\WinSCPPortable\WinSCPlog_ts_master_documents_folder.log" /ini=nul ^
  /command ^
    "open sftp://zzzz:zzzz@zz.zzz.zzz.zz:zzzz/ -hostkey=""zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz""" ^
    "lcd ""f:\""" ^
    "cd /" ^
    "synchronize -filemask="|thumbs.db" remote -delete ""F:\TS MASTER DOCUMENTS"" /""TS MASTER DOCUMENTS""" ^
    "exit"
jpjohnson

Help with Syncronizing

We would like to

  1. Sync ANY file or folder new or modified RECURSIVELY.
  2. From Local to SFTP
  3. Excluding thumbs.db (yes we can just have Windows not create them but I would still like to know how to exclude a file)

Currently it is not syncing modified folder/files but rather everything
Currently it seems to only sync sub folders and contents through 8 directories from local.

We would like it to recurse through all sub directories. Yes these paths can be 10 to 20 directories deep.

Below is the code in the txt file WinSCP is following:
option batch continue
option confirm off
option synchdelete on
open WGDJobInfoSync
lcd \\servername\Company\Jobs
synchronize -filemask="*.db" remote "\\servername\Company\Jobs" "/TESTING/Jobs_TEMP"
exit