Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Guest

With the problem being related to the WinSCP.Lock, I tried adding a Thread.Sleep(3000) to give it some time to clear itself out before attempting the removal. This might have solved the issue as it appears to be working, but it feels a bit clunky.
KLH

Sorry Martin.

The stuff above the seperator is from my ftpsSession class

class FtpsSession

    {
public RemovalOperationResult RemoveFiles(string path)
    {
        using (WinSCP.Session session = new WinSCP.Session())
        {
          session.Open(Config.FtpSessionOptions);
          return session.RemoveFiles(session.EscapeFileMask(path));
        }
    }
}


I hope that makes it clearer.
martin

Re: Recursive calls not allowed - Deleting a directory

Your duplicate post on Stack Overflow:
<invalid hyperlink removed by admin>

While this post includes more code, it's not clear what is the ftpsSession and whether the ftpsSession.RemoveFiles is calling WinSCP Session.RemoveFiles or your RemoveFiles method.
KLH

Recursive calls not allowed - Deleting a directory

I have established that directories exist. I go through the rfi.names list to removed them but always get the Recursive calls not allowed.

public RemovalOperationResult RemoveFiles(string path)

    {
        using (Session session = new Session())
        {
          session.Open(Config.FtpSessionOptions);
          return session.RemoveFiles(session.EscapeFileMask(path));
        }
    }
----------------------------------------------------
 RemoteDirectoryInfo rdi = ftpsSession.ListDirectory(ftpPath);
 foreach (RemoteFileInfo rfi in rdi.Files)
 {
    if (rfi.IsDirectory)
      {

         RemovalOperationResult ror;
         ror = ftpsSession.RemoveFiles(ftpPath + rfi.Name);
         if (ror.IsSuccess)
         {
         foreach (RemovalEventArgs removal in ror.Removals){
            log.Event("Removal of " + removal.FileName + " succeeded");
         }
     }
     else
     {
         log.Event("Removal failed.");
         return false;
     }


It doesn't seem to matter what the path is.
It does seem to be resolving to the right point. Everything else I am doing besides removal is working happily. I am very confused.