Move file on FTP Server

0 votes
asked Mar 22, 2010 by Vineed 1 (160 points)
edited Sep 15, 2011


I am using Rebex.Net Component for FTP Transfers. I have a folder "New" on a FTP Server. Is it possible to transfer a file to another folder "Done" on the same server. Currently the only workaround seems to download the file to the Local Machine of the client from the server and then upload it again to the new folder and delete it from earlier folder.

I am building a VB.Net 2.0 Windows Application using Rebex.Net component and I am having the above requirement. I do not want the file to be downloaded to the client machine, but should transfer from one folder to another (like cut & paste a file in Windows).

Is it possible using Rebex. Please let me know if there is some function or property to enable this type of transfer. Urgent!!!

Thanks and Regards


Applies to: Rebex FTP/SSL

2 Answers

+2 votes
answered Mar 22, 2010 by Lukas Matyska (59,530 points)
edited Sep 2, 2010
Best answer


to move a file simply use the Rename method

client.Rename("/New/file.txt", "/Done/file.txt")
commented Mar 24, 2010 by Vineed 1 (160 points)
Hi Lukas, Wow! That all I have do?!!!. Wasted a lot of time researching for this. Thanks for your time. Regards. Vineed
0 votes
answered Sep 14, 2011 by JayashreeShetty (140 points)
edited Sep 15, 2011

Hi Lukas,

client.Rename("/New/file.txt", "/Done/file.txt") is giving below error for my Sftp.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Rebex.Net.SftpException: Permission denied; Permission denied. It was working fine for some other sftp.

Please suggest

Thanks, Jaya

commented Sep 14, 2011 by Lukas Matyska (59,530 points)
edited Sep 14, 2011

From the exception message it seems to be an access permission issue. Please ensure you have write/delete permission in the "/New" folder and write permission in the "/Done" folder.

commented Sep 15, 2011 by JayashreeShetty (140 points)
edited Sep 15, 2011

Thanks Lukas,

Yes its permission issue with the folder where I am moving the file. Script can move the file to other folder in same sFTP.