User (Old forums)MemberApril 23, 2007 at 5:56 pmPost count: 23064
Here’s what I did:
1. Synchronize a local folder with an FTP folder that had two files in the local folder
2. Synchronize the same folders again
3. Synchronize the same folders a third time.
Here’s what happened:
1. 2 Files were uploaded successfully to the FTP folder
2. 2 files were downloaded from the FTP folder and the time stamps on the local files were updated.
3. 2 files were downloaded from the FTP folder and the time stamps on the local files were updated.
Here’s what I think SHOULD have happened:
1. 2 files are uploaded and the time stamps should match what is on the local folder
2. nothing should have been transferred
3. nothing should have been transferred
Am I missing an option someplace? For my application I never really want a true synchronization, but a copy from the local folder to the ftp folders (kind of like when you are publishing a web site).
Any help that can be provided would be appreciated.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by David (had 3549 views)User (Old forums)MemberApril 24, 2007 at 3:16 pmPost count: 23064
Can we see the code you use for the synchronization part?
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 282 views)User (Old forums)MemberApril 24, 2007 at 4:56 pmPost count: 23064
This is the code I used. I didn’t include the event code because I don’t think it is important.
Private Sub Synchronize()
Dim sServer As String = “server.com”
Dim sUser As String = “user”
Dim sPass As String = “pass”
Dim FTPConn As FtpConnection
FTPConn = New FtpConnection(sServer, sUser, sPass)
Dim SourcePath As AbstractFolder = New DiskFolder(“c:\source”)
Dim DestPath As AbstractFolder = New FtpFolder(FTPConn, “/dest/subfolder/”)
‘ For the purpose of this example, we’ll monitor folder operations
‘ in the synchronizations we perform in order to clearly see what’s going on
‘ since the Analysis even doesn’t cover operations on folders.
Dim sync As SynchronizationEvents = New SynchronizationEvents()
AddHandler sync.FolderOperationAnalysis, AddressOf syncEvents_FolderOperationAnalysis
AddHandler sync.FolderSynchronizationProgression, AddressOf syncEvents_FolderSynchronizationProgression
AddHandler sync.SynchronizationProgression, AddressOf syncEvents_SynchronizationProgression
AddHandler sync.Analysis, AddressOf syncEvents_Analysis
‘ Synchronize the three locations
Synchronizer.Synchronize(Nothing, Nothing, sync, “test data”, Nothing, SourcePath, DestPath)
Catch ex As Exception
AddLogItem(“ERROR: ” & ex.Message)
If Not ex.InnerException Is Nothing Then
AddLogItem(” ” & ex.InnerException.Message)
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by David (had 329 views)User (Old forums)MemberApril 25, 2007 at 5:30 pmPost count: 23064
The problem is probably that the FTP server does not set the DateTime of the file to what it is locally. Thus, since there is no master, the synchronization is done once from local to remote, the remote file now has a new DateTime, and synchronize is done again from remote to local.
When using FtpFolder/FtpFile, it is better to set a master, which means the item is the one that will be considered to be up to date and used to replace other items. To do this, use the overloaded Synchronize method in which you can specify a masterItemIndex. This should resolve the issue.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 4391 views)
- You must be logged in to reply to this topic.