Changeset 14248


Ignore:
Timestamp:
Dec 2, 2019 3:53:01 PM (5 days ago)
Author:
molsson
Message:

#5843 Added FileUtil.recursiveDeleteMatching().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mo-2735/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/util/files/FileUtil.java

    r13732 r14248  
    323323        return res;
    324324    }
     325   
     326    public static void recursiveDeleteMatching(Path dir, DirectoryStream.Filter<Path> filter) throws IOException {
     327        if (filter.accept(dir)) {
     328            recursiveDelete(dir.toFile());
     329            return;
     330        }
     331        if (Files.isDirectory(dir)) {
     332            for (Path child : Files.newDirectoryStream(dir)) {
     333                recursiveDeleteMatching(child, filter);
     334            }
     335        }
     336    }
    325337
    326338    /**
Note: See TracChangeset for help on using the changeset viewer.