This question is a more special case of the problem described (and solved) in this question.
I have two methods, stopAndRemove(ServerObject server) and a close() met
... removing files that aren't XML from a directory list...
List files = Arrays.asList(dir.listFiles()); Iterator i = files.iterator(); while (i.hasNext()) { File file = i.next(); if (!file.getName().endsWith(".xml")) { i.remove(); } }