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: Problem with filemask/exclude

See https://winscp.net/eng/docs/faq_batch_file#quotes
It should be:
"synchronize local D:\folder\ /folder -filemask=""*.csv; |*/history/""" ^

Or simply (without the space):
"synchronize local D:\folder\ /folder -filemask=*.csv;|*/history/" ^
cretu

Re: Problem with filemask/exclude

This was an older post. I know... i have looked through a lot of similar forum posts but I can't manage to get an exclusion working in one of my batch files. The command and the error are below. It looks like the pipeline is interpreted as a command argument or as a separate command
"synchronize local D:\folder\ /folder -filemask="*.csv; |*/history/"" ^

'*' is not recognized as an internal or external command,
operable program or batch file.
grefabu

Hi,

this work, sureley.
And now I recognize why I didn't see the filemask in the log file: I've a mask in front of my eyes, the log will not override instead it is an cating to the exist, I've to scroll down.

There are two spelling on german for my situation:
Tomaten auf den Augen
Kaum macht man's richtig, schon funktionierts

Thank you!

Gregor
grefabu

Problem with filemask/exclude

Hi,

there are several threads about exclude subfolders when download a folder structure.
But I've a additional question:
I want to write an batch file for sheduled task:
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" /log="C:\SCRIPT\WINSCP/backup.log" /command "open sftp://USER@HOST/ -hostkey=""ssh-ed25519 255 2EoAW+4XY0jeOEv5I6lXIqpWbPH2zR3npd/5IUOx1qY="" -privatekey=""C:\SCRIPT\WINSCP\id_rsa.ppk"" -passphrase=""PASS""" "get / D:\Backup\" "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

This work so far, but one subfolder is read protected and WinSCP exit.
I don't now how I ignore the error so I want to exclude the subfolder with the -filemask property adding --filemask=|*/postgresdumps/:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /log="C:\SCRIPT\WINSCP/backup.log" /command "open sftp://USER@HOST/ -hostkey=""ssh-ed25519 255 2EoAW+4XY0jeOEv5I6lXIqpWbPH2zR3npd/5IUOx1qY="" -privatekey=""C:\SCRIPT\WINSCP\id_rsa.ppk"" -passphrase=""PASS""" "get / D:\Backup\"" -filemask=|*/postgresdumps/" "exit"

When that doesn't work I wonder and I've a look in the log file.
And now the really unsuspected: In the command written down to the log the Parameter didn't appear. I tried it with several changes, but in in the log file I found nothing about filemask,...

Then I've tried it with an scp script and the same behavior, the script works, but no filemask entry.

Why I get this behavior? And is there another way to prefend the break on permission denied?

Bye

Gregor