| | |
| | | * @author Ulrich Hilger, 15. Januar 2024 |
| | | */ |
| | | public class Eraser { |
| | | |
| | | public static final int OP_DELETE = 3; |
| | | |
| | | public String deleteFiles(String relPath, List<String> fileNames, String base) { |
| | | String result = null; |
| | | try { |
| | |
| | | //logger.fine(targetFile.getAbsolutePath()); |
| | | if (targetFile.isDirectory()) { |
| | | CopyMoveVisitor bearbeiter = new CopyMoveVisitor(); |
| | | bearbeiter.setOperation(Const.OP_DELETE); |
| | | bearbeiter.setOperation(OP_DELETE); |
| | | Files.walkFileTree(targetFile.toPath(), bearbeiter); |
| | | } else { |
| | | /* |
| | |
| | | die so heissen, also z.B. alle [Dateiname]*.jpg |
| | | */ |
| | | String fname = targetFile.getName().toLowerCase(); |
| | | if (fname.endsWith(Const.JPEG) |
| | | || fname.endsWith(Const.JPG) |
| | | || fname.endsWith(Const.PNG)) { |
| | | if (fname.endsWith(ImageFileFilter.JPEG) |
| | | || fname.endsWith(ImageFileFilter.JPG) |
| | | || fname.endsWith(ImageFileFilter.PNG)) { |
| | | deleteImgFiles(targetDir, targetFile); |
| | | } else { |
| | | targetFile.delete(); |