Skip to content

Instantly share code, notes, and snippets.

@GabrielCzar
Created April 25, 2018 21:29
Show Gist options
  • Save GabrielCzar/96af5e902c76ee24d77bfb955116a5bc to your computer and use it in GitHub Desktop.
Save GabrielCzar/96af5e902c76ee24d77bfb955116a5bc to your computer and use it in GitHub Desktop.
public String get(String filename) throws IOException {
Path root = Paths.get("data");
Stream<Path> other = Files.walk(root, 3).filter(path -> !path.equals(root)).map(root::relativize);
List<Path> paths = (other.collect(Collectors.toList()));
System.out.println(paths);
for (Path path: paths)
if (path.toString().matches("^[A-z\\/]*" + filename))
return path.toString();
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment