I have the following code working within a Files.walkFileTree but not working in a normal main method.
Check this out:
Code: Select all
PathMatcher pm =FileSystems.getDefault().getPathMatcher("glob:*.txt)");
if(pm.matches(Paths.get("/home/user/Desktop/TryThisOut.txt")))
{
System.out.println("true")
}
else
{
System.out.println("false");
}
Could you copy and paste the above code in any main method please? (prior to that it's needed changing the path to a valid path pointing to any .txt present in your desktop)
It should print out true, however I get false..
Thanks in advance.
The_Nick.