SynchronizeDirectories Path Error

Advertisement

Rob_C
Joined:
Posts:
1
Location:
Australia (yes it does exist)

SynchronizeDirectories Path Error

Hi folks.
Hoping someone can point me in the right direction:

Running SynchronizeDirectories in a .net app and for the life of me, I can't get past this error:
"Error listing directory \u0027/C:/Users/REMOVED/data/UAT/SOMETHING\\*.*\u0027.\r\nError retrieving file list for \"/C:/Users/REMOVED/data/UAT/SOMETHING\\*.*\".\r\nSystem Error. Code: 123.\r\nThe filename, directory name, or volume label syntax is incorrect"

The thing is, I am copying the remote path directly from the GUI in WinSCP.
I have tried just about any combination of characters. User has permission - obviously can verify with the GUI.

Code (snippet) is:

sessionOptions = new SessionOptions
{
   Protocol = Protocol.Sftp,
   HostName = Config.host,// "example.com",
   UserName = Config.username, // "user",
   Password = Config.password, // "mypassword",
   SshHostKeyFingerprint = Config.sslcert //= "ssh-rsa 2048 xxxxxxxxxxx...="
};
 
   using (Session session = new Session())
   {
      // Will continuously report progress of synchronization
      session.FileTransferred += FileTransferred;
      // Connect
      session.Open(sessionOptions);
 
      // Synchronize files
      SynchronizationResult synchronizationResult;
      synchronizationResult =
      session.SynchronizeDirectories(
      SynchronizationMode.Remote, Config.remotepath,
      Config.localpath,
      false,
      false, SynchronizationCriteria.Time);
      // Throw on any error
      synchronizationResult.Check();

basically straight from the sample code.


Any suggestions greatly appreciated.
Cheers,
Rob

Reply with quote

Advertisement

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

Re: SynchronizeDirectories Path Error

First, you have the arguments (named?) wrong. It's localPath, remotePath, not the other way around.

Then, your Config.remotepath (which actually seem to contain a local path) probably contains that \u0027. I'm not sure where/how did you get that error message. \u0027 is a single quote. But were it a single quote, it would probably be printed as an actual single quote. So maybe the Config.remotepath actually contains that literal sequence "\u0027".

This does not seem to be a WinSCP question, but generic programming issue. If you believe otherwise, please attach a full session log file showing the problem (using the latest version of WinSCP).

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.

Reply with quote

Advertisement

You can post new topics in this forum