Re: unable to delete local files
WinSCP won't obviously remove exiting local files if they are also present in the source remote directory. That's a point of synchronization.
If you want to download all files not present in the local directory and then delete all previous local files, you have to implement this on your own.
You can use synchronization and then iterate all local files, deleting those that were not synchronized.
I suggest you use
See this example:
https://winscp.net/eng/docs/library_example_delete_after_successful_download
It employs mechanisms you need for implementation.
If you want to download all files not present in the local directory and then delete all previous local files, you have to implement this on your own.
You can use synchronization and then iterate all local files, deleting those that were not synchronized.
I suggest you use
Session.SynchronizeDirectories
from WinSCP .NET assembly from a PowerShell script..
See this example:
https://winscp.net/eng/docs/library_example_delete_after_successful_download
It employs mechanisms you need for implementation.