Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Eclipse project related files without deleteing the source from Eclipse

Whenever we want to create an Eclipse project with an existing source location, we will choose the existing source location(root) as the project location. Eclipse will create all the project specific files in the root directory of that source.

Now, for some reason if we want to re-create the project with different setting, how should we tell Eclipse to not remove the source but all the project related files? It's basically cleaning up all the Eclipse related files. For example, I want to create the project in some other IDE, do I have to go to the project directory and manually identify all the Eclipse related files and remove them?

When we try to delete the project from Eclipse, we are left with two choices, delete everything from the project (when checkbox is checked) or retain everything in the project (this would only remove the project from the project explorer but retains all the project related files in the root source directory).

Every time, manually deleting project related files is cumbersome. It would be good if there is anyway to delete only Eclipse related project files right from Eclipse.

Any thoughts?

like image 594
ernesto Avatar asked May 16 '13 11:05

ernesto


1 Answers

On UNIX/Linux you can do it "manually" - Open Terminal and navigate to your project's root directory then execute the following command:

find . \( -name .classpath -o -name .project -o -name .settings \) -exec rm -rf {} \;

And if someone likes aliases:

alias show_eclipse_files='find . \( -name .classpath -o -name .project -o -name .settings \)'
alias delete_eclipse_files='find . \( -name .classpath -o -name .project -o -name .settings \) -exec rm -rf {} \;'

NOTE: You'd better remove the project first from Eclipse so it won't get confused by the missing configuration.

like image 79
nyxz Avatar answered Oct 29 '22 03:10

nyxz