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

natchiram

Re: Exclude files starting with a specific name

martin wrote:

You didn't mention batch file until now.

It should be like this then:
     "get -filemask=*>=today|temp*" ^

Or:
     "get -filemask=""*>=today | temp*""" ^

See:
https://winscp.net/eng/docs/faq_batch_file#quotes
https://winscp.net/eng/docs/faq_batch_file#newline_escaping


Sorry, I should have mentioned that. Thanks for your suggestions and tried both the variations with same result but your second link on "New-line Escaping" has "get *" ^ in the example. So I tried "get -filemask=*>=today|temp* *" ^ and it finally worked. Thanks for pointing me in the right direction.
natchiram

Re: Exclude files starting with a specific name

WinSCP version that I am using is 5.17.5 Build 10414

This is the code that I am using

@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Users\username\Documents\WinSCP\WinSCP.log" /ini=nul ^
  /command ^
    "open ftp://server details/ -rawsettings ProxyPort=0" ^
    "cd /folder" ^
    "lcd \\path" ^
     get -filemask=*>=today|temp*
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
natchiram

Re: Exclude files starting with a specific name

martin wrote:

No spaces (or wrap the mask to quotes):
get -filemask=*>=today|temp*


Thanks for your reply. Without wrapping the filemask, the script wouldn't even run but with wrapping, I am getting this error "Missing parameter for command 'get'"
martin

Re: Exclude files starting with a specific name

No spaces (or wrap the mask to quotes):
get -filemask=*>=today|temp*
natchiram

Exclude files starting with a specific name

Hello guys,

I am trying a script to download all the files generated today but exclude the files that start with "temp". I am able to get all the files today using the filemask

get -filemask=*>=today but I am not sure how to add exclude file mask to leave the files that start with "temp"

I tried get -filemask=*>=today | temp* and some other variations but not getting any success. I am missing something but not sure what. Any suggestions?

Regards,
Ram