FTP error 501 Server cannot accept argument

patrick

Well-known member
Joined
Dec 5, 2021
Messages
251
Programming Experience
1-3
Hello

An error occurs.
error : 501 Server cannot accept argument

C#:
using FluentFTP;
 string host = "100.12.32.40";
            string user = "user1";
            string pass = "pw1";
            int port = 21;

            string sourcefolder = @"/test1";

            string host1 = "200.10.31.21";
            string user1 = "user2";
            string pass1 = "pw2";
            int port1 = 21;


            string dstfolder = @"/TEMP";

            using (FtpClient cl = new FtpClient())
            {
                cl.Host = host;
                cl.Credentials = new NetworkCredential(user, pass);
                cl.Encoding = System.Text.Encoding.UTF8;
                cl.Connect();

                using (FtpClient cl1 = new FtpClient())
                {
                    cl1.Host = host1;
                    cl1.Credentials = new NetworkCredential(user, pass);
                    cl1.Encoding = System.Text.Encoding.UTF8;
                    cl1.Connect();

                    var uploadResult = cl.TransferDirectory(sourcefolder, cl1, dstfolder, FtpFolderSyncMode.Update, FtpRemoteExists.Skip, FtpVerify.None, null, null);
                }
            }

Please Help me
 
This isn't at C# question. This is a FluentFTP and/or FTP question. Have you tried asking the library authors?
 
Have you tried using an FTP application to access the same server? That should be part of your testing, to see what connection details, etc, you need to use there and thus also use in your code. If you're trying to do something in your code that you can't do in an FTP client then it's bound to fail. It's going to be hard for anyone who hasn't actually used FluentFTP to help you with the specifics of that library but if you're getting an error message from the server in your code then you'd expect the same error when doing the same thing in an FTP application, e.g. FileZilla.
 

Latest posts

Back
Top Bottom