在批处理文件中使用 WinSCP 时如何从 FTP 上传中排除子文件夹

How to exclude a subfolder from an FTP upload when using WinSCP in a batch file

我创建了一个批处理文件,使用 WinSCP 将文件从我的本地服务器上传到远程服务器

这是我的代码。

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\log\WinSCP.log" /ini=nul ^
  /command ^
    "open s3://USername:PAssword@s3.amazonaws.com/" ^
    "lcd E:\Backups" ^
    "cd /backup/Backup/Config" ^
    "put LiveMainTrade" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

LiveMainTrade文件夹下,我有ABC三个文件夹。我想排除文件夹 A,只上传文件夹 BC

谢谢

使用-filemask switch排除子文件夹,如:

    "put -filemask=|C\ LiveMainTrade" ^

https://winscp.net/eng/docs/file_mask#directory