0
Reply

how to move file from one folder to another folder.

arvind kumar

arvind kumar

Aug 24 2013 4:56 AM
1.9k
1.> I have a folder(DirTest) on FTP in which files are coming.
2.> I created another folder(BackupDirTest) using given code below.
      private static void CreateFTPDir()
        {
            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("ftp://FTPServerIP/" + " BackupDirTest");
            request.Credentials = new NetworkCredential("anonymous", "anonymous");
            request.UsePassive = true;
            request.UseBinary = true;
            request.KeepAlive = false;
            //Console.WriteLine("Getting the response");

            request.Method = WebRequestMethods.Ftp.MakeDirectory;
 
            using (var resp = (FtpWebResponse)request.GetResponse())
            {
                //Console.WriteLine(resp.StatusCode);
                FTPdestinationPath = resp.ResponseUri.ToString();
            }
        }

3.> How to shared this(BackupDirTest) folder using c# code, so that I can get shared path. And I can use below code for moving file from 1 folder to another folder.
File.Move(FTPsourcePath, FTPdestinationPath +"\\"+ FileName); 
Because this "Move" function is working in local compute but its not working on FTP Server Why?