ernesto
ernesto

Reputation: 1989

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?

Upvotes: 8

Views: 11945

Answers (4)

stacker
stacker

Reputation: 68942

For Windows the problem could be solved with PowerShell:

Get-ChildItem -include  .settings -recurse | Remove-Item -force -recurse
Get-ChildItem -include  .classpath -recurse | Remove-Item -force -recurse

Upvotes: 1

user7272384
user7272384

Reputation:

Thanks for this thread. I would like to do exactly the same. I am following these steps now. 1. Delete project from the Project Explorer (do not delete from disk) 2. Remove .cproject .project .metadata .settings and other eclipse configuration files manually from the disk. This is a way-around and would appreciate if there is a better way to do the same (but everything from within Eclipse). Thanks

Upvotes: 0

nyxz
nyxz

Reputation: 7418

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.

Upvotes: 8

ConstantineUA
ConstantineUA

Reputation: 1051

I've faced same problem recently and the most reasonable solution was to use export wizard with additional setup of filter types. So steps to obtain project files without eclipse settings:

  1. Right click on desired project and select Export;
  2. Choose General > File System;
  3. In opened tab select destination directory, choose file extensions to export (.html, .css and .js in my case) with Filter Types option and click Finish

Hope that my answer helps to someone

Upvotes: 1

Related Questions