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 :-)

asked 07 Dec '10, 10:41

Duncan's gravatar image

Duncan
262
accept rate: 0%

edited 07 Dec '10, 12:07


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

link

answered 07 Dec '10, 16:19

Martin%20Vobr's gravatar image

Martin Vobr ♦♦
335310
accept rate: 37%

edited 07 Dec '10, 16:30

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×152

Asked: 07 Dec '10, 10:41

Seen: 884 times

Last updated: 30 Mar '11, 00:22