NewGuyComesIn
NewGuyComesIn

Reputation: 189

WinSCP - Do not synchronize subdirectories

I am writing winscp script in VBA to synchronize certain files from remote to local. The code I am using is

""synchronize -filemask=""""*.xlsx"""" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect""

There are three xlsx files: 14.xlsx, 12.xlsx, 13.xlsx. However, seems like it is running through all the files even though it is not synchronizing them. Besides, one folder under JrnlDetailSFTPDirect is also downloaded from remote, which is not expected.enter image description here

Is it possible to avoid looping through all the files, just selecting those three files and downloading them?

Thanks

Upvotes: 3

Views: 3014

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202393

There are separate masks for files and folders.

To exclude all folders, use */ exclude mask:

synchronize -filemask="*.xlsx|*/" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect

See How do I transfer (or synchronize) directory non-recursively?


I cannot tell anything regarding the other problem, as you didn't show us names of the files. Ideally, append a session log file to your question. Use /log switch like:

winscp.com /log=c:\writablepath\winscp.log /command ...

Upvotes: 4

Related Questions