Assume all the files referenced by these paths exist:
Path a = Paths.get("c:/temp/dir/a.txt"); Path b = Paths.get("c:/temp/dir/subdir/b.txt");
What is the correct string to pass to PathMatcher to match both these files?
/
.txt"
.txt"/
.txt"
.txt"B is correct.
matches zero or more characters, including multiple directories.
A is incorrect because */ only matches one directory.
It will match "temp" but not "c:/temp," let alone "c:/temp/dir."
C is incorrect because *.txt only matches filenames and not directory paths.
D, E, and F are incorrect because the paths we want to match do not begin with a slash.
G is incorrect because of the above.