org.h2.tools.DeleteDbFiles has following issue with case sensitivity:
Let's say my database is called "AAA.mv.db" and I pass "AAA" to org.h2.tools.DeleteDbFiles.execute() in order to delete all files associated with it.
Let's also say, I have a sub-folder aaa in my database directory (which is also passed to execute()
Later:
String start = db == null ? null : (FileUtils.toRealPath(dir + "/" + db) + ".");
=> start will be aaa, i.e. it found the sub-folder.
Later the startsWith will fail, due to different cases ('AAA' vs. 'aaa'):
if (db == null || f.startsWith(start)) {
files.add(f);
}
files won't contain the actual DB files associated with AAA, so they won't be deleted.