7

My workspace filesystem folder is currently C:\work\Eclipse-Workspace_PROJ and my code filesystem folder is C:\work\PROJ.

I want to rename C:\work\PROJ to C:\work\PROJ-1 but last time I renamed it . . . bad things happened.

QUESTION

What are the steps to rename my code filesystem folder without corrupting things?

Bob
  • 4,576
  • 7
  • 39
  • 107

4 Answers4

6

You can use Move in the context menu of the Navigator view to move the project to a different folder. This will move the project to a different folder without renaming it.

I sometimes get an error message that the move failed, but the only thing I can see is that the root folder at the old project location is not deleted. After deleting it no further problems occurred (Eclipse Neon.1 / 4.6.1).

Note that the Move function in CDT's Project Explorer view cannot do this.

Since your projects are not inside the workspace directory, they are not at their default location. So renaming the project won't rename the folder.

starblue
  • 55,348
  • 14
  • 97
  • 151
2

You should always rename things like Projects inside Eclipse using 'Refactor > Rename'.

There are many things in Eclipse that need to know about the rename, refactor will deal with updating them all.

If you are asking about renaming the Workspace folder then you do that outside of Eclipse (with Eclipse not running). Provided all the plug-ins you have installed in Eclipse are written correctly Eclipse should not care what the workspace folder is called.

Take a backup first if you are worried things may go wrong.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • How do you rename the root directory of the code from inside Eclipse? The root CONTAINS the Eclipse projects. I cannot see the root folder inside my Eclipse project folder view. – Bob Feb 10 '17 at 21:37
  • Your question is not really clear what you are renaming. I have added info about renaming the workspace. – greg-449 Feb 10 '17 at 21:57
  • I clarified it. – Bob Feb 10 '17 at 22:05
  • 1
    I can rename the workspace folder but that's not my question. Question is: how do I rename the root folder inside of which my code resides? – Bob Apr 26 '17 at 17:29
  • In my original question, it would be renaming `PROJ` to `PROJ-1`, not `Eclipse-Workspace_PROJ` – Bob Apr 26 '17 at 17:30
  • was you able to find the solution, how did u renamed your project in file system from "PROJ" to "PROJ-1". I have the same issue. – Waleed Asif May 20 '22 at 14:41
1

The real answer, according to the comments to this SO answer is that CDT doesn't have the ability to move projects on disk. :(

Community
  • 1
  • 1
Bob
  • 4,576
  • 7
  • 39
  • 107
1
  1. Copy (not move/rename) the directory on the filesystem to the desired new location.
  2. Delete the Eclipse .project file in that new directory
  3. Delete the old project in Eclipse.
  4. Create a new project in Eclipse at the new location.
  5. Delete the old directory from the filesystem.
BuvinJ
  • 10,221
  • 5
  • 83
  • 96