Re: Synchronize each directories
Hi Martin - I've got this working already. Yes, the file mask do the trick. Now I got multiple backgroundworkers doing the job = faster operation. here's the piece of code below
public void Synchronize()
{
//this.TransferOptions.FileMask = "*.* | */";
string localpath = WebsiteFileInfo.DirInfo.FullName + @"\";
localpath = localpath.Replace(@"\\", @"\");
this.TransferOptions.FileMask = string.Format(@"{0}*.* | {1}/*/", localpath, WebsiteFileInfo.RemotePath);
SynchronizationResult synchronizationResult;
synchronizationResult = _ftpSession.SynchronizeDirectories(SynchronizationMode.Remote, WebsiteFileInfo.DirInfo.FullName, WebsiteFileInfo.RemotePath, this.DeleteObsoleteFiles, this.Mirror, this.SynchronizationCriteriaOptions, this.TransferOptions);
try
{
synchronizationResult.Check();
}
catch (System.Exception e)
{
this.WebsiteFileInfo.Error = string.Format("{0}", e);
}
//
_transfersCount = synchronizationResult.Uploads.Count;
_failuresCount = synchronizationResult.Failures.Count;
//
this.WebsiteFileInfo.Processed = true;
this.IsBusy = false;
}
Cheers!
:D :D :D
public void Synchronize()
{
//this.TransferOptions.FileMask = "*.* | */";
string localpath = WebsiteFileInfo.DirInfo.FullName + @"\";
localpath = localpath.Replace(@"\\", @"\");
this.TransferOptions.FileMask = string.Format(@"{0}*.* | {1}/*/", localpath, WebsiteFileInfo.RemotePath);
SynchronizationResult synchronizationResult;
synchronizationResult = _ftpSession.SynchronizeDirectories(SynchronizationMode.Remote, WebsiteFileInfo.DirInfo.FullName, WebsiteFileInfo.RemotePath, this.DeleteObsoleteFiles, this.Mirror, this.SynchronizationCriteriaOptions, this.TransferOptions);
try
{
synchronizationResult.Check();
}
catch (System.Exception e)
{
this.WebsiteFileInfo.Error = string.Format("{0}", e);
}
//
_transfersCount = synchronizationResult.Uploads.Count;
_failuresCount = synchronizationResult.Failures.Count;
//
this.WebsiteFileInfo.Processed = true;
this.IsBusy = false;
}
Cheers!
:D :D :D