List of usage examples for org.apache.wicket.util.file Folder getFolders
public Folder[] getFolders()
From source file:org.artifactory.common.wicket.component.file.path.PathHelper.java
License:Open Source License
public List<File> getFiles(String path, PathMask mask) { String absolutePath = getAbsolutePath(path); Folder folder = new Folder(getPathFolder(absolutePath)); if (!folder.exists() || !folder.isDirectory()) { return Collections.emptyList(); }// w w w . j a va 2 s .co m if (!isParentOf(workingDirectoryPath, folder)) { return Collections.emptyList(); } Folder[] folders = folder.getFolders(); File[] files = folder.getFiles(); List<File> filesList = new ArrayList<>(folders.length + files.length); if (mask.includeFolders()) { for (Folder file : folders) { String fileAbsPath = file.getAbsolutePath().replace('\\', '/'); if (startsWithIgnoreCase(fileAbsPath, absolutePath)) { filesList.add(file); } } } if (mask.includeFiles()) { for (File file : files) { String fileAbsPath = file.getPath().replace('\\', '/'); if (startsWithIgnoreCase(fileAbsPath, absolutePath)) { filesList.add(file); } } } return filesList; }