Option not to transfer "empty" directories in on TODO list:
Meanwhile, your only option is to script the transfer using .NET assembly (e.g. in PowerShell).
Your task is somewhat similar to this:
So you can base your script on that.
To preserve timestamps of directories, you can use
Though that affects newly created folders. If you want to update timestamps of modified folders, WinSCP cannot do that. Again, you would have to script it (e.g. in PowerShell as above).
Awesome! Thank you Martin! I have played around with the .NET assembly and have been able to everything I can with the scripting, and more with file and directory control.
I am using this in an SSIS package and have been able to build a c# script to delete empty directories with the following:
public void Main()
Dts.TaskResult = (int)ScriptResults.Success;
catch (Exception ex)
Dts.TaskResult = (int)ScriptResults.Failure;
private static void ProcessDirectory(string startLocation)
foreach (var directory in Directory.GetDirectories(startLocation))
if (Directory.GetFiles(directory).Length == 0 && Directory.GetDirectories(directory).Length == 0)