I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List
If you use apache commonsIO you can use for the filesystem (optionally with extension filter):
Collection files = FileUtils.listFiles(new File("directory/"), null, false);
and for resources/classpath:
List files = IOUtils.readLines(MyClass.class.getClassLoader().getResourceAsStream("directory/"), Charsets.UTF_8);
If you don't know if "directoy/" is in the filesystem or in resources you may add a
if (new File("directory/").isDirectory())
or
if (MyClass.class.getClassLoader().getResource("directory/") != null)
before the calls and use both in combination...