Info about PathMatcher
Posted: Wed Aug 14, 2013 5:12 am
Hi everybody,
I have the following code working within a Files.walkFileTree but not working in a normal main method.
Check this out:
It should prnt out true because the glob is correct and the file do ends with ".txt", the same pattern used with PathMatcher works when used in a Files.walkFileTree method..(visitFile().)
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.
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.