- return;
- }
-
- int numcharstart = template.indexOf(BackupFiles.NUM_PLACEHOLDER);
- String templateStart = template;
- String templateEnd = "";
- if (numcharstart > -1)
- {
- templateStart = template.substring(0, numcharstart);
- templateEnd = template.substring(numcharstart + BackupFiles.NUM_PLACEHOLDER.length());
- }
- int startLength = base.length() + templateStart.length();
- int endLength = templateEnd.length() + extension.length();
- String numString = filename.substring(startLength, filename.length() - endLength + 1);
-
- if (filename.length() >= startLength + digits + endLength
- && filename.startsWith(base + templateStart)
- && filename.endsWith(templateEnd + extension)
- && numString.matches("[0-9]+"))
+ File file = new File(
+ dir.getCanonicalPath() + File.separatorChar + filename);
+ if (file.isDirectory())
+ {
+ // backup files aren't dirs!
+ return false;
+ }
+ } catch (IOException e)