Paul Ngom wrote:Your hint led me to this:
OK, well
Path has a
toFile() method, and
File has a
toPath() method, so you can easily convert between the two. I think I've given you enough to get to your own solution. The important thing is to
understand how that trawl() method works; don't just parrot the code. Otherwise, you'll be back as soon as you need to do something slightly different.
So, if you haven't already, get out a pencil and paper and
write down what it does with a few sample file names. You don't need to be exhaustive, but do a few levels, so that you understand what's going on.
Unless you come from a pure maths background, recursion can be
very difficult to "visualise". As I said previously, I've been at this lark a long time, and I
still have to think hard about it.
HIH
Winston