Modify this chapters DirectoryDescription program to print name and size information for only those files whose glob

Question:

Modify this chapter’s DirectoryDescription program to print name and size information for only those files whose “glob” pattern matches a user-specified string. To do this, you’ll need to prompt for and read the desired “glob” pattern. In addition to Scanner, you’ll need to use the Java FileSystem and PathMatcher classes to create a matcher object like that in the constructor of this chapter’s FileVisitor class. Then, you’ll need to put the for-each loop’s printf statement inside an if statement whose condition is something like matcher.matches(name), where name comes from path.getFileName().

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: