0 votes
by (160 points)
edited

Hi

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

Vineed

Applies to: Rebex FTP/SSL

2 Answers

+2 votes
by (72.7k points)
edited
 
Best answer

Hello,

to move a file simply use the Rename method

client.Rename("/New/file.txt", "/Done/file.txt")
by (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
by (140 points)
edited

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

by (72.7k points)
edited

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.

by (140 points)
edited

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.

Jaya

...