Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: CompareDirectories

Please attach a full session log file showing the problem (using the latest version of WinSCP). Name a file that you believe should have been identified as different, but was not.

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
tdilpme

CompareDirectories

Hi All,
I'm just trying to do a CompareDirectories like such:
var compareDirectoryResult = session.CompareDirectories(SynchronizationMode.Both,
    $@"{SettingsVM.CustomerInputDeckDirectory}\{folder.Name}",
    SettingsVM.ConcurrentRemoteFileLocation, false, false, SynchronizationCriteria.Either);

If there are differences, I list them and if there are not just let user know the directories are the same. (Like this)
if (compareDirectoryResult.Count > 0)
{
// I list the changes
}
else
{ 
  // Let user know they are the same
}

The problem I encounter is that the files in the local and remote folders are all the same name, and size, but there will be a couple files with the "Last Modified" attribute different by a few minutes or so, but my result comes back as compareDirectoryResult.Count == to zero therefore not catching any changes. Am I doing something wrong in how I'm calling this method? Not sure how to make it accurate. Please help.