Java Path File Name nio getFilePathsInFolder(String sensorName)

Here you can find the source of getFilePathsInFolder(String sensorName)

Description

get File Paths In Folder

License

Apache License

Declaration

public static List<String> getFilePathsInFolder(String sensorName) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

public class Main {
    public static List<String> getFilePathsInFolder(String sensorName) {
        List<String> pathList = new ArrayList<String>();
        try (Stream<Path> paths = Files.walk(Paths.get("../../ase_data/atc-rawdata-1/" + sensorName))) {
            paths.forEach(filePath -> {
                if (Files.isRegularFile(filePath)) {
                    pathList.add(filePath.toString());
                }/*from  w w w.ja  v a2  s . co  m*/
            });
            Collections.sort(pathList);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return pathList;
    }
}

Related

  1. getFileNames(List fileNames, Path dir, String ext, boolean recursive)
  2. getFileNames(List fileNames, Path dir, String sFilter)
  3. getFileNameWithoutExt(final Path file)
  4. getFilePath(String dirName)
  5. getFilePathName(Path filePath)
  6. getFilesFromDirectory(Path directory, List filenames)
  7. getFormattedDisplayName(String fileDisplayName, Path path, String baseDir)
  8. getFullFileName(Path path)
  9. getFullPath(String basePath, String fileName)