removeFiles option in session.SynchronizeDirectories

Advertisement

thething
Joined:
Posts:
1

removeFiles option in session.SynchronizeDirectories

I am trying to do a one-way sync from remote to local and have anything that has been removed from remote also removed from local.

Following the PS example it seems like it would go in here somewhere but I have no idea how to call or reference the param/option.
$session.SessionLogPath = $sessionLogPath
 
# Connect
Write-Host "Connecting..."
$session.Open($sessionOptions)
 
# Synchronize files
Write-Host "Comparing files..."
$synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, $destination, "/", $False)
 
# Throw on any error
$synchronizationResult.Check()
Documentation says to use the removeFiles param to enable this functionality. Where does it go? I have looked through https://winscp.net/eng/docs/library_session_synchronizedirectories but the PS example does not detail how one would use these additional options. If this is a rudimentary question, I'm sorry, I am not a programmer, just a network guy trying to get something running.

TIA

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: removeFiles option in session.SynchronizeDirectories

The removeFiles is fourth parameter of the Session.SynchronizeDirectories.
You are currently passing $False there. Just replace it with $True.

Reply with quote

Advertisement

You can post new topics in this forum