Session.SynchronizeDirectories error
I am using the SynchronizeDirectories in PowerShell, through the .Net assembly to clear a remote directory. Sometimes, the SynchronizeDirectories function will try to delete a folder that is not empty.
I am using SynchronizeDirectories likes this:
this will sometimes result in this error:
##[error]Exception calling "Check" with "0" argument(s): "Error deleting file
'/Remote/Folder/With/Content/Foler_1'.
The directory is not empty.
Error code: 18
Error message from server (en): The directory is not empty. "
I have noticed this only happens with a folder that has an underscore in the name. The error occurrs when calling $synchronizationResult.Check().
I am using SynchronizeDirectories likes this:
$synchronizationResult = $session.SynchronizeDirectories( [WinSCP.SynchronizationMode]::Remote, "C:\LocalEmptyFolder", "/Remote/Folder/With/Content, $True, $True, [WinSCP.SynchronizationCriteria]::Either, $transferOptions) $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.PreserveTimestamp = $True
this will sometimes result in this error:
##[error]Exception calling "Check" with "0" argument(s): "Error deleting file
'/Remote/Folder/With/Content/Foler_1'.
The directory is not empty.
Error code: 18
Error message from server (en): The directory is not empty. "
I have noticed this only happens with a folder that has an underscore in the name. The error occurrs when calling $synchronizationResult.Check().