Exclude files from download via filemask

Advertisement

AlLeX_
Joined:
Posts:
13

Exclude files from download via filemask

Hello,

I am getting all files from a SFTP server with a script but I have to exclude a certain file type from download. For example *temp files.

Thanks a lot for your help

Reply with quote

Advertisement

AlLeX_
Joined:
Posts:
13

Thank you very much for your answer.

Is there a possibility to exclude a file via its suffix with -filemask switch? This is not mentioned in the documentation.

For example: I have to download all files except those with *.tmp sufix.

Something like this? (this does not work):
-delete -filemask <> *.tmp

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

That's correct, just that you can omit the leading *.* actually and use just |*.tmp.

You have also omitted the "equal sign", but I assume you actually use it, otherwise it cannot work.

The correct and simplest syntax is:
-filemask=|*.tmp

Reply with quote

Advertisement

Guest

Excluded files

I need your help with what is happening to me.

I have a script that transfers files to an FTP server, I have no exclude or advanced settings, but the following happens to me.

I have 10 files with TXT format, 5 start with the name AB and the others start with the name CD, and it only transfers the ones with the name AB, the CD files are excluded for no reason.

Can anyone help me by telling me what is going on.

An additional fact, if I replace the initial of the name CD to DE, the same file is transferred without problems.

Attached is the command you are running..;
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\ep_depot\Temp\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://xxxxxxx/ -hostkey=""ssh-dss xxxxxx="" -privatekey=""H:\keys\SSH_private_key.ppk""" ^
    "lcd ""H:\Forms\Forms\Final""" ^
    "cd /DO" ^
    "put *" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Excluded files

@Guest: Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum