views:

57

answers:

2

So, how to count number of files in an Eclipse project, with the specific requirement that derived resources should not be counted. (otherwise one could easily use unix command line tools to calculate that) Linked and virtual resources need not be considered, although, bonus points if you do.

A: 

A plugin like metrics could at least gives you the number of classes, which is a good approximation for the number of files (if you omit nested classes).
Note: I haven't tested that plugin with recent Eclipse (3.5 or 3.6) releases.

It would consider the scope of the project (meaning included other projects included in the build path)

alt text

VonC
A: 

Ah, found a proper way to do it: Open the File Search dialog, delete all text in the "Containing text:" field, select the "File name pattern" you want (for all files that would be ""), and then selected the scope you want (workspace, selected resources, etc.). Execute the search and then look at the match count in the Search view. The key here is the "Containing text:" field. If it is "", it will matches lines instead of just files. I tried originally to use a regexp that would match only once per file, such as "\A(.|\R)?", which works to a certain extent (matches all non-empty, non-binary files). But only the empty text field solution will indeed find all files in the Eclipse resource model (including linked and virtual folders, but not derived or team-private resources).

BrunoMedeiros