Existing files are copied to destination every time
I have created a Powershell script to synchronize files from a source- to destination folder. The target is a Microsoft IIS FTP-server.
Copying is based on the following method:
SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote
... and should synchronize a remote folder based on the contents of the source folder.
All worked great for days and subsequent runs just copied only the new files as it should. THEN at some point in time it just started copying all files every time and I have not figured out the reason. It could be as part of my code being developed, affecting the behavior, but I feel its pretty standard with regards to setting up the session. Date / time is preserved on the remote folders.
I have set the following session options:
-----------------------------------------------------
$sessionOptions.Protocol = $script:protocol
$sessionOptions.HostName = $script:ftpserver
$sessionOptions.UserName = $script:user
$sessionOptions.Password = $script:password
$sessionOptions.FtpMode = [WinSCP.FtpMode]::Passive
Transfer options:
------------------------------------------------------
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.PreserveTimestamp = $true
Any idea?
Regards
Copying is based on the following method:
SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote
... and should synchronize a remote folder based on the contents of the source folder.
All worked great for days and subsequent runs just copied only the new files as it should. THEN at some point in time it just started copying all files every time and I have not figured out the reason. It could be as part of my code being developed, affecting the behavior, but I feel its pretty standard with regards to setting up the session. Date / time is preserved on the remote folders.
I have set the following session options:
-----------------------------------------------------
$sessionOptions.Protocol = $script:protocol
$sessionOptions.HostName = $script:ftpserver
$sessionOptions.UserName = $script:user
$sessionOptions.Password = $script:password
$sessionOptions.FtpMode = [WinSCP.FtpMode]::Passive
Transfer options:
------------------------------------------------------
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.PreserveTimestamp = $true
Any idea?
Regards