Java Code Examples for org.apache.commons.io.FilenameUtils#wildcardMatchOnSystem()
The following examples show how to use
org.apache.commons.io.FilenameUtils#wildcardMatchOnSystem() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetectFileFinder.java From hub-detect with Apache License 2.0 | 6 votes |
private List<File> findDirectoriesContainingDirectoriesToDepthRecursive(final File sourceDirectory, final String directoryPattern, final int currentDepth, final int maxDepth) { final List<File> files = new ArrayList<>(); if (currentDepth > maxDepth || !sourceDirectory.isDirectory()) { return files; } for (final File file : sourceDirectory.listFiles()) { if (file.isDirectory()) { if (FilenameUtils.wildcardMatchOnSystem(file.getName(), directoryPattern)) { files.add(file); } else { files.addAll(findDirectoriesContainingDirectoriesToDepthRecursive(file, directoryPattern, currentDepth + 1, maxDepth)); } } } return files; }
Example 2
Source File: DetectorExclusionSearchFilter.java From hub-detect with Apache License 2.0 | 5 votes |
@Override public boolean shouldExclude(File file) { for (final String excludedDirectory : excludedDirectories) { if (FilenameUtils.wildcardMatchOnSystem(file.getName(), excludedDirectory)) { return true; } } return fileFilter.accept(file); //returns TRUE if it matches one of the file filters. }
Example 3
Source File: DetectFileFinder.java From hub-detect with Apache License 2.0 | 5 votes |
private List<File> findDirectoriesContainingFilesRecursive(final File sourceDirectory, final String filenamePattern, final int currentDepth, final int maxDepth) { final Set<File> files = new HashSet<>(); if (currentDepth > maxDepth || !sourceDirectory.isDirectory()) { return new ArrayList<>(files); } for (final File file : sourceDirectory.listFiles()) { if (file.isDirectory()) { files.addAll(findDirectoriesContainingFilesRecursive(file, filenamePattern, currentDepth + 1, maxDepth)); } else if (FilenameUtils.wildcardMatchOnSystem(file.getName(), filenamePattern)) { files.add(sourceDirectory); } } return new ArrayList<>(files); }