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

Use file mask |*/ to exclude all (sub-)directories.



In scripting, use -filemask switch of respective command (get, put or synchronize) to set the file mask:

put -filemask="|*/" *

.NET Assembly

With WinSCP .NET Assembly, use TransferOptions.FileMask property to set the file mask:

TransferOptions transferOptions = new TransferOptions();
transferOptions.FileMask = "|*/";
session.PutFiles(@"d:\toupload\*", "/home/user/", false, transferOptions);


In GUI, specify the |*/ in File mask box on Transfer Settings dialog.

Though there’s actually Exclude directories predefined transfer setting preset.

Last modified: by martin