- int dirNameInt = Integer.parseInt(dirName.toString());
- if (latestFolder < dirNameInt && dirNameInt <= newestFolder) {
- Path targetPath = toPath.resolve(fromPath
- .relativize(dir));
- if (!Files.exists(targetPath)) {
- Files.createDirectory(targetPath);
+ try {
+ int dirNameInt = Integer.parseInt(dir.getFileName().toString());
+ if (latestFolder < dirNameInt && dirNameInt <= newestFolder) {
+ Path targetPath = toPath.resolve(fromPath.relativize(dir));
+ Files.createDirectories(targetPath);
+ return FileVisitResult.CONTINUE;