Java Path File Name nio getPaths(Path dir, String fileNames)

Here you can find the source of getPaths(Path dir, String fileNames)

Description

get Paths

License

Open Source License

Declaration

public static List<Path> getPaths(Path dir, String fileNames) throws IOException 

Method Source Code


//package com.java2s;
// it under the terms of the GNU Lesser General Public License as published by

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<Path> getPaths(Path dir, String fileNames) throws IOException {
        List<Path> paths = new ArrayList<>();

        DirectoryStream<Path> directories = Files.newDirectoryStream(dir);
        for (Path path : directories) {
            if (!Files.isDirectory(path)) {
                continue;
            }//from   w w w.ja va2 s .  c  o m
            Path file = path.resolve(fileNames);
            if (!Files.exists(file)) {
                continue;
            }

            paths.add(file);
        }
        directories.close();

        return paths;
    }
}

Related

  1. getPathCleanName(Path object)
  2. getPathInTmpDir(String fileName)
  3. GetPathName(String path)
  4. getPathOfClass(Class cls, String filename)
  5. getPathProperty(Properties props, String propName)
  6. getPrefix(final Path file, final int filenameSuffixLength)
  7. getPrintWriter(String className, String flushPath)
  8. getProvenanceLogFiles(final String baseName, final Collection allProvenanceLogs)
  9. getQualifiedName(String outputDir, Path path)