FTP error 501 Server cannot accept argument


Well-known member
Dec 5, 2021
Programming Experience

An error occurs.
error : 501 Server cannot accept argument

using FluentFTP;
 string host = "";
            string user = "user1";
            string pass = "pw1";
            int port = 21;

            string sourcefolder = @"/test1";

            string host1 = "";
            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;

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

                    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.
Top Bottom