Click here to Skip to main content
15,891,881 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai Everybody,

I need to move the file from one folder to another folder in FTP by renaming it (in C#).

I dont know how to move the file from one folder to another folder in FTP.


Please let me know how to approach.


Thanks in advance,
Srinivas.
Posted
Updated 20-Mar-18 23:16pm
Comments
jaideepsinh 7-Aug-13 2:47am    
Which ftp do you use?
[no name] 10-Aug-13 3:30am    
Any More information?

If you are trying to upload then
Try using EnterpriseDT.Net.Ftp
Just add edtFTPnet.dll to you project.

Link to view the class
http://www.enterprisedt.com/products/edtftpnetpro/doc/manual/api/html/N_EnterpriseDT_Net_Ftp.htm[^]

Link to download edtFTPnet.dll and sample
http://www.enterprisedt.com/products/edtftpnet/downloadlink.html[^]

Sample Code
C#
using EnterpriseDT.Net.Ftp;

//Declare as Ftp
private FTPConnection FTP;


//To Connect to ftp
private bool TryConnect()
	{
		bool ret = false;
		try {
			FTP = new FTPConnection();
			FTP.ServerAddress = "192.168.1.13";//Server IP address
			FTP.UserName = "username";//server user name
			FTP.Password = "******";//Password
			FTP.ConnectMode = FTPConnectMode.PASV;
			FTP.Connect();
			ret = FTP.IsConnected;

		} catch (Exception ex) {
		}
		return ret;
	}

//To Send File
if (TryConnect()) 
{
FTP.UploadFile("Directory", "File Name", false);
}
 
Share this answer
 
v3
Comments
[no name] 10-Aug-13 3:31am    
Good
The upfront answer is - you can't do it.
FTP does not allow a file to be directly copied from host A to host B.

What you can do is download the file to your machine from host A and then upload it to host B.
In this case, Solution 2, by Winston is one good option, and if you want other example of code, let me know.

Cheers,
Edo
 
Share this answer
 
move-files-in-ftp-by-c[^]

Hope it will help...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900