import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.PathMatcher; import java.nio.file.Paths; public class GlobExample { public static void main(String[] args) { FileSystem fileSystem = FileSystems.getDefault(); PathMatcher pathMatcher = fileSystem.getPathMatcher("glob:**/*.txt"); Path path1 = Paths.get("/path/to/file.txt"); Path path2 = Paths.get("/path/to/directory/file.txt"); Path path3 = Paths.get("/path/to/file.csv"); } }


上一篇:
下一篇:
切换中文