Welcome to CodeRanch! I added code tags to make your post easier to read. You are pretty close using recursion. Think about the method signature - public void listFilesInDirectory(File dir) .
Suppose it had an extra parameter to keep track of the level. What would you pass in the first time you call it? What would you do to that value when you were one more level down?