Pattern based file selection and deletion in Eclipse IDE
Asked Answered
T

1

5

What I'm trying to is tag a batch of files for deletion within Eclipse, prior to issuing a commit via the Subversive integration to "delete" these files from the repository.

In a trivial case, you can of course do this by selecting multiple files in the explorer, alt-clicking and selecting delete, prior to doing a commit.

However, I need to do this on ~500 files that are spread across a directory hierarchy six+ levels deep.

As such, I'm wondering if there's any way to select and perform the standard alt-click operations on a group of files matching a given pattern, or indeed whether this is the best approach in the first instance.

Taurus answered 13/7, 2011 at 12:25 Comment(0)
W
12

From the Eclipse main menu bar, select Search > File. Leave the "Containing Text" field blank, and enter the file name pattern you want.

This will display the files you're interested in in the Search view. To delete them:

  • In the view menu of the Search view (icon is a downward-pointing triangle, just to the left of the minimise/maximise buttons), select "show as list" instead of "show as tree". This hides directories from the Search view, and shows only the files which matched the pattern.
  • Select all files in the Search view with Ctrl-A
  • Right-click the selected files and choose Show In > Navigator from the popup menu. All matched files are now selected in the Navigator view.
  • Right-click one of the selected files in the Navigator, and choose Delete.
Wensleydale answered 13/7, 2011 at 13:34 Comment(4)
This will show the files in the search results tab, but how can I then delete them?Taurus
@middaparka: My mistake, I assumed you could delete files directly from the search results. I've expanded the answer, it should give what you want now.Wensleydale
Damn, that's contrived. (Obviously no fault of yours, that said.) However, it works perfectly so many, many thanks. :-)Taurus
@middaparka: indeed, it's a bit bizarre to have to go to those kind of lengths! The way I would actually solve this would probably be to do a search with Unix find or with the OS's file manager, and just refresh Eclipse after deleting the files. But at least we know there's some way to do it in Eclipse.Wensleydale

© 2022 - 2024 — McMap. All rights reserved.