Write Host on Removal of Files during Synchronize with RemoveFiles enabled – PowerShell
I am largely following the template provided here
https://winscp.net/eng/docs/library_session_synchronizedirectories#example
I have configured the Removal of Files during Synchronize with
In the example, all errors and status are sent through the
I tried to add this
Thanks
https://winscp.net/eng/docs/library_session_synchronizedirectories#example
I have configured the Removal of Files during Synchronize with
removeFiles
enabled and I need to write out the status of those operations along with the other sync operations.
In the example, all errors and status are sent through the
FilesTransferred
function, how do I include the removed files as well?
I tried to add this
$e.Removal
case, but it does not seem to work.
if ($e.Touch -ne $Null) { if ($e.Touch.Error -eq $Null) { Write-Host "Timestamp of $($e.Touch.FileName) set to $($e.Touch.LastWriteTime)" } else { Write-Host "Setting timestamp of $($e.Touch.FileName) failed: $($e.Touch.Error)" } } if ($e.Removal -ne $Null) { if ($e.Removal.Error -eq $Null) { Write-Host "Deleted $($e.Removal.FileName) " } else { Write-Host "Could not Delete $($e.Removal.FileName): $($e.Removal.Error)" } } else { # This should never happen during "local to remote" synchronization Write-Host "Timestamp of $($e.Destination) kept with its default (current time)" }