+1 vote
by (130 points)
edited

Using the FTP control, how do I rename a directory/folder on the FTP site in VB.Net? "FTP.Rename(fromPath, toPath)" just returns an error... "The process cannot access the file because it is being used by another process (550)"

Edit: Actually, getting this on deleting folders too, on multiple sites.

Edit Again: Found the problem! The error was a result of the current directory being set to the directory I'm trying to delete :-)

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (13.0k points)
edited

Nice to know that you've found the solution, Duncan.

Anyway, I'm including the code for others who might be facing the same situation:

   Dim client as Ftp
   client = new Ftp()
   client.Connect("hostname")
   client.Login("username","password")
   client.Rename ("/old/folder", "/new/directory")
   client.Disconnect()

Please note that it may fail if someone (either you, another FTP user or a different process) has their current directory set to "/old/folder". Also, some FTP servers don't support renaming directories.

Similar questions: http://forum.rebex.net/questions/120/move-file-on-ftp-server

...