2

check modify file to upload with out winscp C# code with out winscp dll for upload new file folder

 SessionOptions sessionOptions = new SessionOptions
        {
            Protocol = Protocol.Ftp,
            HostName = "ftpserver",
            UserName = "user",
            Password = "password",
        };

        using (Session session = new Session())
        {
            // Connect
            session.Open(sessionOptions);

            // Download files created in 2017-06-15 and later
            TransferOptions transferOptions = new TransferOptions();
            transferOptions.FileMask = "*>=2016-01-01";
        transferOptions).Check();
          session.PutFiles(@"d:\toupload\*", "/", false, transferOptions).Check();

        }

1 Answers1

0

Is this what you are looking for?

Code from the link. This helps to upload a local directory to FTP using native c# code.

private void recursiveDirectory(string dirPath, string uploadPath)
    {
        string[] files = Directory.GetFiles(dirPath, "*.*");
        string[] subDirs = Directory.GetDirectories(dirPath);

        foreach (string file in files)
        {
            ftpClient.upload(uploadPath + "/" + Path.GetFileName(file), file);
        }

        foreach (string subDir in subDirs)
        {
            ftpClient.createDirectory(uploadPath + "/" + Path.GetFileName(subDir));
            recursiveDirectory(subDir, uploadPath + "/" + Path.GetFileName(subDir));
        }
    }
Sin
  • 1,836
  • 2
  • 17
  • 24